… | |
… | |
3 | AE - simpler/faster/newer/cooler AnyEvent API |
3 | AE - simpler/faster/newer/cooler AnyEvent API |
4 | |
4 | |
5 | =head1 SYNOPSIS |
5 | =head1 SYNOPSIS |
6 | |
6 | |
7 | use AnyEvent; # not AE |
7 | use AnyEvent; # not AE |
|
|
8 | |
|
|
9 | # file handle or descriptor readable |
|
|
10 | my $w = AE::io $fh, 0, sub { ... }; |
|
|
11 | |
|
|
12 | # one-shot or repeating timers |
|
|
13 | my $w = AE::timer $seconds, 0, sub { ... }; # once |
|
|
14 | my $w = AE::timer $seconds, interval, sub { ... }; # repeated |
|
|
15 | |
|
|
16 | print AE::now; # prints current event loop time |
|
|
17 | print AE::time; # think Time::HiRes::time or simply CORE::time. |
|
|
18 | |
|
|
19 | # POSIX signal |
|
|
20 | my $w = AE::signal TERM => sub { ... }; |
|
|
21 | |
|
|
22 | # child process exit |
|
|
23 | my $w = AE::child $pid, sub { |
|
|
24 | my ($pid, $status) = @_; |
|
|
25 | ... |
|
|
26 | }; |
|
|
27 | |
|
|
28 | # called when event loop idle (if applicable) |
|
|
29 | my $w = AE::idle { ... }; |
|
|
30 | |
|
|
31 | my $w = AE::cv; # stores whether a condition was flagged |
|
|
32 | $w->send; # wake up current and all future recv's |
|
|
33 | $w->recv; # enters "main loop" till $condvar gets ->send |
|
|
34 | # use a condvar in callback mode: |
|
|
35 | $w->cb (sub { $_[0]->recv }); |
|
|
36 | |
8 | |
37 | |
9 | =head1 DESCRIPTION |
38 | =head1 DESCRIPTION |
10 | |
39 | |
11 | This module documents the new simpler AnyEvent API. |
40 | This module documents the new simpler AnyEvent API. |
12 | |
41 | |