AnyEvent::Sub::Retry - retry $n times in AnyEvent
use AnyEvent::Sub::Retry; use AnyEvent::Socket; my $guard; my $cv = retry 3, 1, sub { my $cv = AE::cv; $guard = tcp_connect "www.google.com", "http", sub { my ($fh) = @_; if ($fh) { $cv->send($fh); } else { $cv->croak("unable to connect: $!"); } }; return $cv; }; my $fh = $cv->recv;
AnyEvent::Sub::Retry is Sub::Retry like module in AnyEvent. In AnyEvent::Sub::Retry, code ref that is executed MUST returrn AnyEvent::CondVar object. Coderef MUST execute $cv->send or $cv->croak on case of error or success.
Copyright (C) maedama.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
maedama <maedama85@gmail.com>
To install AnyEvent::Sub::Retry, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnyEvent::Sub::Retry
CPAN shell
perl -MCPAN -e shell install AnyEvent::Sub::Retry
For more information on module installation, please visit the detailed CPAN module installation guide.