1 |
use AnyEvent; |
2 |
BEGIN { eval q{use AnyEvent::Impl::EventLib;1} or ((print qq{1..0 # SKIP AnyEvent::Impl::EventLib not found}), exit 0) } |
3 |
|
4 |
$| = 1; print "1..5\n"; |
5 |
|
6 |
print "ok 1\n"; |
7 |
|
8 |
my $cv = AnyEvent->condvar; |
9 |
|
10 |
my $error = AnyEvent->timer (after => 5, cb => sub { |
11 |
print <<EOF; |
12 |
Bail out! No signal caught. |
13 |
EOF |
14 |
exit 0; |
15 |
}); |
16 |
|
17 |
my $sw = AnyEvent->signal (signal => 'INT', cb => sub { |
18 |
print "ok 3\n"; |
19 |
$cv->broadcast; |
20 |
}); |
21 |
|
22 |
print "ok 2\n"; |
23 |
kill 'INT', $$; |
24 |
$cv->wait; |
25 |
undef $error; |
26 |
|
27 |
print "ok 4\n"; |
28 |
|
29 |
undef $sw; |
30 |
|
31 |
print "ok 5\n"; |
32 |
|