1 |
BEGIN { |
2 |
unless (exists $SIG{USR1}) { |
3 |
print <<EOF; |
4 |
1..0 # SKIP Broken perl detected, skipping tests. |
5 |
EOF |
6 |
exit 0; |
7 |
} |
8 |
} |
9 |
|
10 |
use AnyEvent; |
11 |
|
12 |
BEGIN { $ENV{PERL_ANYEVENT_LOOP_TESTS} or ((print qq{1..0 # SKIP PERL_ANYEVENT_LOOP_TESTS not true\n}), exit 0) } |
13 |
BEGIN { eval q{use AnyEvent::Impl::EventLib;1} or ((print qq{1..0 # SKIP AnyEvent::Impl::EventLib not loadable\n}), exit 0) } |
14 |
|
15 |
|
16 |
|
17 |
$| = 1; print "1..5\n"; |
18 |
|
19 |
print "ok 1\n"; |
20 |
|
21 |
my $cv = AnyEvent->condvar; |
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 |
|
30 |
my $sw = AnyEvent->signal (signal => 'INT', cb => sub { |
31 |
print "ok 3\n"; |
32 |
$cv->broadcast; |
33 |
}); |
34 |
|
35 |
print "ok 2\n"; |
36 |
kill 'INT', $$; |
37 |
$cv->recv; |
38 |
undef $error; |
39 |
|
40 |
print "ok 4\n"; |
41 |
|
42 |
undef $sw; |
43 |
|
44 |
print "ok 5\n"; |
45 |
|