AE-AdHoc
view release on metacpan or search on metacpan
Revision history for AE-AdHoc
0.08 Sat Oct 27 2012
* API: Add ae_action { CODE } for delayed execution.
* API: Add timeout and soft_timeout options to ae_recv.
0.07 Sun Sep 16 2012
* API: Add magic variables for error handling
* FIX: Fix ae_goal, add verbose error messages for leftover callbacks
0.05 Sun Sep 09 2012
* API: Add multiple goal interface (ae_goal)
0.04 Sun Sep 09 2012
* API: Add arglist support to callbacks: ae_recv { ae_send->(1..5) };
* API: Add extra arguments to callback: ae_recv { ae_send(1..5) };
* Example added (port-probe.pl)
0.03 Thu Sep 06 2012
* API: Make empty/zero $timeout illegal.
0.0203 Tue Aug 14 2012
* Fixed empty $timeout undef warning.
* Minor code cleanup.
lib/AE/AdHoc.pm view on Meta::CPAN
BEGIN {
our @ISA = qw(Exporter);
our @EXPORT = qw(ae_recv ae_send ae_croak ae_begin ae_end ae_goal ae_action);
};
=head2 ae_recv { CODE; } [ $timeout ] %options;
The main entry point of the module.
Run CODE block, enter event loop and wait for $timeout seconds for callbacks
set up in CODE to fire, then die. Return whatever was sent via C<ae_send>.
$timeout must be a nonzero real number. Negative value means "run forever".
$timeout=0 would be ambigous, so it's excluded.
Options may include:
=over
=item * timeout - override the $timeout parameter (one timeout MUST be present).
lib/AE/AdHoc.pm view on Meta::CPAN
croak shift;
};
=head1 CAVEATS
This module is still under heavy development, and is subject to change.
Feature/change requests are accepted.
=head2 Callback confinement
If event loop is entered several times, the callbacks created in one
invocations will NOT fire in another. Instead, they'll issue a warning
and return (see "Error handling" below).
Error message will be like C<ae_send at file:13 from ae_recv[1] at file:12
called in ae_recv[2] at file:117>
This is done so to isolate invocations as much as possible.
However, detection of "this invocation" will go wrong if callback maker is
called in a callback itself. For instance, this will always work the same:
( run in 0.230 second using v1.01-cache-2.11-cpan-eab888a1d7d )