NAME

AnyEvent::Delay::Simple - Manage callbacks and control the flow of events by AnyEvent

SYNOPSIS

use AnyEvent::Delay::Simple;

my $cv = AE::cv;

delay([
    sub { say('1st step'); },
    sub { say('2nd step'); die(); },
    # never calls because 2nd step failed
    sub { say('3rd step'); }],
    # calls on error
    sub { say('Fail: ' . $@); $cv->send(); },
    # calls on success
    sub { say('Ok'); $cv->send(); }
);
$cv->recv();

DESCRIPTION

AnyEvent::Delay::Simple manages callbacks and controls the flow of events for AnyEvent. This module inspired by Mojo::IOLoop::Delay.

FUNCTIONS

delay

delay(\@steps, $finish);
delay(\@steps, $error, $finish);

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.

SEE ALSO

AnyEvent, AnyEvent::Delay, Mojo::IOLoop::Delay.

SUPPORT

Repository

http://github.com/AdCampRu/anyevent-delay-simple

Bug tracker

http://github.com/AdCampRu/anyevent-delay-simple/issues

AUTHOR

Denis Ibaev dionys@cpan.org for AdCamp.ru.

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/ for more information.