diff options
author | Yorhel <git@yorhel.nl> | 2012-02-22 11:30:31 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2012-02-22 11:30:31 +0100 |
commit | a48423c3966f9f7e0ecfa1dfe119c07de3d872c8 (patch) | |
tree | 4e2995c8f9646a58f282507f2e7ec066b33674f3 /test.pl | |
parent | 438a4e684a35e249b13b13a20bf8465e4471a119 (diff) |
Allow a different AnyEvent::Handle for reading and writing
This allows two unidirectional pipes (e.g. STDIN/STDOUT) to be used for
communication. There's no obvious or efficient way to combine two pipes
into a single AnyEvent::Handle.
Diffstat (limited to 'test.pl')
-rwxr-xr-x | test.pl | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -117,11 +117,15 @@ sub t_double { my $done = AnyEvent->condvar; $done->begin; $done->begin; - $sa->link(AnyEvent::Handle->new(fh => $socka), sync => $f&1, + $sa->link( + handle => AnyEvent::Handle->new(fh => $socka), + sync => $f&1, on_ready => sub { $done->end }, $DEBUG ? (on_write => sub { note 'A: ',Data::Dumper::Dumper(\@_) }) : (), ); - $sb->link(AnyEvent::Handle->new(fh => $sockb), sync => $f&2, + $sb->link( + handle => AnyEvent::Handle->new(fh => $sockb), + sync => $f&2, on_ready => sub { $done->end }, $DEBUG ? (on_write => sub { note 'B: ',Data::Dumper::Dumper(\@_) }) : (), ); |