AnyEvent-Beanstalk-Worker
view release on metacpan or search on metacpan
lib/AnyEvent/Beanstalk/Worker.pm view on Meta::CPAN
}
sub handle {
my $event = shift;
$_->($event) for @{$watchers{$event->{type}}};
}
The C<@events> list (or queue, since events are read as a FIFO) might
be populated asynchronously from system events, such as receiving
signals, network data, disk I/O, timers, or other sources. The
C<handle()> subroutine checks the C<%watchers> hash to see if there
are any watchers or handlers for this event and calls those
subroutines as needed. Some of these subroutines may add more events
to the event queue. Then the loop starts again.
Most of the time you never see the event loop--you just start it. For
example, most of the time when I'm programming with B<EV>, this is all
I ever see of it:
EV::run;
( run in 1.055 second using v1.01-cache-2.11-cpan-49f99fa48dc )