# if you prefer function calls, look at the AE manpage for
# an alternative API.
# file handle or descriptor readable
my $w = AnyEvent->io (fh => $fh, poll => "r", cb => sub { ... });
# one-shot or repeating timers
my $w = AnyEvent->timer (after => $seconds, cb => sub { ... });
my $w = AnyEvent->timer (after => $seconds, interval => $seconds, cb => ...);
print AnyEvent->now; # prints current event loop time
print AnyEvent->time; # think Time::HiRes::time or simply CORE::time.
# POSIX signal
my $w = AnyEvent->signal (signal => "TERM", cb => sub { ... });
# child process exit
my $w = AnyEvent->child (pid => $pid, cb => sub {
my ($pid, $status) = @_;
...
});
# called when event loop idle (if applicable)
my $w = AnyEvent->idle (cb => sub { ... });
my $w = AnyEvent->condvar; # stores whether a condition was flagged
$w->send; # wake up current and all future recv's
$w->recv; # enters "main loop" till $condvar gets ->send
# use a condvar in callback mode:
$w->cb (sub { $_[0]->recv });