Sub::Retry - retry $n times
use Sub::Retry; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); my $res = retry 3, 1, sub { $ua->post('http://example.com/api/foo/bar'); };
Sub::Retry provides the fuction named 'retry'.
This function calls \&code. If the code throws exception, this function retry $n_times after $delay seconds.
\&code
$n_times
$delay
Return value of this function is the return value of \&code. This function cares wantarray.
Tokuhiro Matsuno <tokuhirom AAJKLFJEF GMAIL COM>
Copyright (C) Tokuhiro Matsuno
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Sub::Retry, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sub::Retry
CPAN shell
perl -MCPAN -e shell install Sub::Retry
For more information on module installation, please visit the detailed CPAN module installation guide.