AnyEvent-Delay

 view release on metacpan or  search on metacpan

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

      $self->{timers}{$id} =  EV::timer 0, 0,  $self->begin 
    }
}

1;

=encoding utf8

=head1 NAME

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

=head1 SYNOPSIS

    # Synchronize multiple events
    my $cv = AE::cv;
    my $delay = AnyEvent::Delay->new();
    $delay->on_finish(sub { say 'BOOM!'; $cv->send });
    for my $i (1 .. 10) {
      my $end = $delay->begin;
      Mojo::IOLoop->timer($i => sub {

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

        sub {
          my ($delay, @args) = @_;
          say 'And done after 5 seconds total.';
          $cv->send;
        }
    );
    $cv->recv;

=head1 DESCRIPTION

L<AnyEvent::Delay> manages callbacks and controls the flow of events for L<AnyEvent>. This module is L<Mojo::IOLoop::Delay> version of AnyEvent. 

=head1 EVENTS

L<AnyEvent::Delay> have method the following.

=head2 on_error

  $delay->on_error(sub {
    my ($delay, $err) = @_;
    ...

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

the right order for the next step or C<on_finish> event method, the argument will be 
array references for each begin callback.


=head2 steps

  $delay = $delay->steps(sub {...}, sub {...});

Sequentialize multiple events, the first callback will run right away, and the
next one once the active event _ae_counter reaches zero. This chain will continue
until there are no more callbacks, a callback does not increment the active
event _ae_counter or an error occurs in a callback.

=head1 SEE ALSO

L<Mojo::IOLoop::Delay>.

=cut



( run in 0.820 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )