[SCM] libmessage-passing-perl Debian packaging branch, master, updated. debian/0.111-3-14-g44f6e88

Tomas Doran bobtfish at bobtfish.net
Mon May 6 11:57:16 UTC 2013


The following commit has been merged in the master branch:
commit 70be91a075cd64179bafe93664d8125fb31ed62b
Author: Tomas Doran <bobtfish at bobtfish.net>
Date:   Mon Jun 11 13:46:38 2012 -0400

    Make STDIN input saner

diff --git a/lib/Message/Passing/Input/STDIN.pm b/lib/Message/Passing/Input/STDIN.pm
index 1c409db..c1b0f40 100644
--- a/lib/Message/Passing/Input/STDIN.pm
+++ b/lib/Message/Passing/Input/STDIN.pm
@@ -2,20 +2,32 @@ package Message::Passing::Input::STDIN;
 use Moose;
 use AnyEvent;
 use Try::Tiny;
+use Scalar::Util qw/ weaken /;
 use namespace::autoclean;
 
-with 'Message::Passing::Role::Input';
+with qw/
+    Message::Passing::Role::Input
+/;
+
+has reader => (
+    is => 'ro',
+    lazy => 1,
+    default => sub {
+        my $self = shift;
+        weaken($self);
+        AnyEvent->io(fh => \*STDIN, poll => 'r', cb => sub {
+            my $input = <STDIN>;
+            return unless defined $input;
+            chomp($input);
+            return unless length $input;
+            $self->output_to->consume($input);
+        });
+    },
+);
 
 sub BUILD {
     my $self = shift;
-    my $r; $r = AnyEvent->io(fh => \*STDIN, poll => 'r', cb => sub {
-        my $input = <STDIN>;
-        return unless defined $input;
-        chomp($input);
-        return unless length $input;
-        $self->output_to->consume($input);
-        $r;
-    });
+    $self->reader;
 }
 
 __PACKAGE__->meta->make_immutable;

-- 
libmessage-passing-perl Debian packaging



More information about the Pkg-perl-cvs-commits mailing list