AnyEvent-Delay-Simple
view release on metacpan or search on metacpan
Revision history for perl module AnyEvent::Delay::Simple
0.06 2014-09-13
- Fixed handling of exceptions that may be raised into condvar
callbacks.
0.05 2014-02-24
[Incompatible changes]
- The condition variable in list of callback arguments of delay()
function moved to the last position.
[New features]
- If the first argument of the delay() or easy_delay() functions is
blessed reference then all callbacks calls as methods of this
reference.
0.04 2013-11-20
[Incompatible changes]
- Implemented control the flow of events within step. Changed
arguments passed to callbacks and handlers.
- Changed rule of importing finction it AE namespace. Now function
will be prefixed with "AE::".
[Other]
- The old version of the delay() function is now called as
easy_delay().
0.03 2013-11-19
- Implemented data transfer along the chain of callbacks.
0.02 2013-11-18
- Implemented import of function into AE namespace.
0.01 2013-11-18
- Initial public release.
{
"abstract" : "Manage callbacks and control the flow of events by AnyEvent",
"author" : [
"Denis Ibaev <dionys@cpan.org>"
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
---
abstract: 'Manage callbacks and control the flow of events by AnyEvent'
author:
- 'Denis Ibaev <dionys@cpan.org>'
build_requires:
Test::Deep: 0
Test::More: 0
configure_requires:
ExtUtils::MakeMaker: 0
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921'
license: perl
NAME
AnyEvent::Delay::Simple - manage callbacks and control the flow of events
by AnyEvent
DESCRIPTION
AnyEvent::Delay::Simple manages callbacks and controls the flow of events
for AnyEvent. This module inspired by Mojo::IOLoop::Delay.
INSTALLATION
To install this module, run the following commands:
perl Makefile.PL
make
make test
make install
lib/AnyEvent/Delay/Simple.pm view on Meta::CPAN
}
1;
__END__
=head1 NAME
AnyEvent::Delay::Simple - Manage callbacks and control the flow of events by AnyEvent
=head1 SYNOPSIS
use AnyEvent::Delay::Simple;
my $cv = AE::cv;
delay(
sub {
say('1st step');
pop->send('1st result'); # send data to 2nd step
lib/AnyEvent/Delay/Simple.pm view on Meta::CPAN
},
sub { # calls on success, not at this time
say('Ok');
$cv->send();
}
);
$cv->recv();
=head1 DESCRIPTION
AnyEvent::Delay::Simple manages callbacks and controls the flow of events for
AnyEvent. This module inspired by L<Mojo::IOLoop::Delay>.
=head1 FUNCTIONS
Both functions runs the chain of callbacks, the first callback will run right
away, and the next one once the previous callback finishes. This chain will
continue until there are no more callbacks, or an error occurs in a callback.
If an error occurs in one of the steps, the chain will be break, and error
handler will call, if it's defined. Unless error handler defined, error is
fatal. If last callback finishes and no error occurs, finish handler will call.
You may import these functions into L<AE> namespace instead of current one.
Just prefix function name with C<AE::> when using module.
use AnyEvent::Delay::Simple qw(AE::delay);
AE::delay(...);
=head2 delay
delay(\&cb_1, ..., \&cb_n, \&err, \&fin);
delay([\&cb_1, ..., \&cb_n], \&fin);
delay([\&cb_1, ..., \&cb_n], \&err, \&fin);
delay($obj, \&cb_1, ..., \&cb_n, \&err, \&fin);
delay($obj, [\&cb_1, ..., \&cb_n], \&fin);
delay($obj, [\&cb_1, ..., \&cb_n], \&err, \&fin);
If the first argument is blessed reference then all callbacks will be calls as
the methods of this object.
Condvar and data from previous step passed as arguments to each callback or
finish handler. If an error occurs then condvar and error message passed to
the error handler. The data sends to the next step by using condvar's C<send()>
method.
sub {
my $cv = pop();
$cv->send('foo', 'bar');
lib/AnyEvent/Delay/Simple.pm view on Meta::CPAN
easy_delay(\&cb_1, ..., \&cb_n, \&err, \&fin);
easy_delay([\&cb_1, ..., \&cb_n], \&fin);
easy_delay([\&cb_1, ..., \&cb_n], \&err, \&fin);
easy_delay($obj, \&cb_1, ..., \&cb_n, \&err, \&fin);
easy_delay($obj, [\&cb_1, ..., \&cb_n], \&fin);
easy_delay($obj, [\&cb_1, ..., \&cb_n], \&err, \&fin);
This function is similar to the previous function. But its arguments contains
no condvar. And return values of each callbacks in chain passed as arguments to
the next one.
sub {
return ('foo', 'bar');
},
sub {
my (@args) = @_;
# now @args is ('foo', 'bar')
},
( run in 3.081 seconds using v1.01-cache-2.11-cpan-9b1e4054eb1 )