ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/AnyEvent-Fork-RPC/t/01_sync.t
Revision: 1.1
Committed: Thu Apr 18 11:02:47 2013 UTC (13 years, 5 months ago) by root
Content type: application/x-troff
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# Content
1 $| = 1;
2 print "1..13\n";
3
4 use AnyEvent;
5 use AnyEvent::Fork::RPC;
6
7 print "ok 1\n";
8
9 my $done = AE::cv;
10
11 my $rpc = AnyEvent::Fork
12 ->new
13 ->eval (do { local $/; <DATA> })
14 ->AnyEvent::Fork::RPC::run ("run",
15 on_error => sub { print "Bail out! $_[0]\n"; exit 1 },
16 on_event => sub { print "$_[0]\n" },
17 on_destroy => $done,
18 );
19
20 print "ok 2\n";
21
22 for (3..6) {
23 $rpc->($_ * 2 - 1, sub { print $_[0] });
24 }
25
26 print "ok 3\n";
27
28 undef $rpc;
29
30 print "ok 4\n";
31
32 $done->recv;
33
34 print "ok 13\n";
35
36 __DATA__
37
38 sub run {
39 my ($count) = @_;
40
41 AnyEvent::Fork::RPC::event ("ok $count");
42
43 "ok " . ($count + 1) . "\n"
44 }
45