ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AE.pm
(Generate patch)

Comparing AnyEvent/lib/AE.pm (file contents):
Revision 1.6 by root, Wed Mar 24 21:22:57 2010 UTC vs.
Revision 1.7 by root, Wed Mar 24 23:28:06 2010 UTC

3AE - simpler/faster/newer/cooler AnyEvent API 3AE - 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
11This module documents the new simpler AnyEvent API. 40This module documents the new simpler AnyEvent API.
12 41

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines