AnyEvent-Delay-Simple

 view release on metacpan or  search on metacpan

lib/AnyEvent/Delay/Simple.pm  view on Meta::CPAN


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
        },
        sub {
            say(@_);                   # receive data from 1st step
            say('2nd step');
            die();
        },
        sub {                          # never calls because 2nd step failed
            say('3rd step');
        },
        sub {                          # calls on error, at this time
            say('Fail: ' . $_[1]);
            $cv->send();
        },
        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>.



( run in 0.534 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )