AnyEvent::Retry::Coro - AnyEvent::Retry for jobs that run in separate threads
version 0.03
use Coro; my $r = AnyEvent::Retry::Coro->new( max_tries => 100, # eventually give up interval => { Constant => { interval => 1 } }, # try every second try => { die 'out of cake!' if $cake-- < 0; return do_science(); }, ); my $neat_gun = $r->run; # keep on trying until you run out of cake
This module makes AnyEvent::Retry work nicely with Coro. You don't need to provide success or failure callbacks anymore, and your task to retry just needs die or return a result.
die
This runs the task, blocking the thread until a result is available. If your task encounters an error, this will die. If it's sucessful, it returns the result.
Allows you to run the task without blocking:
$r->start; ...; # do anything my $result = $r->wait; # block here
run is implemented exactly like the above.
run
Jonathan Rockway <jrockway@cpan.org>
This software is copyright (c) 2010 by Jonathan Rockway.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install AnyEvent::Retry, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnyEvent::Retry
CPAN shell
perl -MCPAN -e shell install AnyEvent::Retry
For more information on module installation, please visit the detailed CPAN module installation guide.