summaryrefslogtreecommitdiff
path: root/test.pl
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2012-02-22 11:30:31 +0100
committerYorhel <git@yorhel.nl>2012-02-22 11:30:31 +0100
commita48423c3966f9f7e0ecfa1dfe119c07de3d872c8 (patch)
tree4e2995c8f9646a58f282507f2e7ec066b33674f3 /test.pl
parent438a4e684a35e249b13b13a20bf8465e4471a119 (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-xtest.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/test.pl b/test.pl
index bed74e0..25470b2 100755
--- a/test.pl
+++ b/test.pl
@@ -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(\@_) }) : (),
);