1 | $|=1; |
1 | $|=1; |
2 | BEGIN { print "1..6\n" } |
2 | BEGIN { |
|
|
3 | print "1..5\n"; |
|
|
4 | } |
3 | |
5 | |
4 | use AnyEvent; |
6 | use AnyEvent; |
5 | use AnyEvent::Impl::Perl; |
7 | use AnyEvent::Impl::Perl; |
|
|
8 | |
|
|
9 | print STDERR <<EOF; |
|
|
10 | |
|
|
11 | If the following test hangs for a long time or terminates with a signal |
|
|
12 | you either found a bug in AnyEvent or, more likely, you have a defective |
|
|
13 | perl (most windows perl distros are broken, cygwin perl works). If you do |
|
|
14 | not rely on signal handlers you can force the installation of this module |
|
|
15 | and the rest will likely work. Otherwise upgrading to a working perl is |
|
|
16 | recommended. |
|
|
17 | EOF |
6 | |
18 | |
7 | print "ok 1\n"; |
19 | print "ok 1\n"; |
8 | |
20 | |
9 | my $cv = AnyEvent->condvar; |
21 | my $cv = AnyEvent->condvar; |
10 | |
22 | |
|
|
23 | my $error = AnyEvent->timer (after => 5, cb => sub { |
|
|
24 | print <<EOF; |
|
|
25 | Bail out! No signal caught. |
|
|
26 | EOF |
|
|
27 | exit 0; |
|
|
28 | }); |
|
|
29 | |
11 | my $sw = AnyEvent->signal (signal => 'CHLD', cb => sub { |
30 | my $sw = AnyEvent->signal (signal => 'INT', cb => sub { |
12 | print "ok 3\n"; |
31 | print "ok 3\n"; |
13 | $cv->broadcast; |
32 | $cv->broadcast; |
14 | }); |
33 | }); |
15 | |
34 | |
16 | print "ok 2\n"; |
35 | print "ok 2\n"; |
17 | kill 'CHLD', 0; |
36 | kill 'INT', $$; |
18 | $cv->wait; |
37 | $cv->wait; |
|
|
38 | undef $error; |
19 | |
39 | |
20 | print "ok 4\n"; |
40 | print "ok 4\n"; |
21 | |
41 | |
22 | undef $sw; |
42 | undef $sw; |
23 | |
43 | |
24 | print "ok 5\n"; |
44 | print "ok 5\n"; |
25 | |
45 | |
26 | kill 'CHLD', 0; |
|
|
27 | |
|
|
28 | print "ok 6\n"; |
|
|