LWP::UserAgent::Patch::Retry - Add retries
This document describes version 0.050 of LWP::UserAgent::Patch::Retry (from Perl distribution LWP-UserAgent-Patch-Retry), released on 2019-09-20.
use LWP::UserAgent::Patch::Retry -n => 2, -delay => 3;
This patch adds retries to LWP::UserAgent when response from request is not a success.
Can be used with WWW::Mechanize because that module uses LWP::UserAgent.
Number of retries. Default is 2, which means it will retry twice (so the total number of requests is 3).
Delay between retries, in seconds.
Specify custom criteria of whether to retry. Will be passed ($self, $response) and should return 1 if retry should be performed. For example if you do not want to retry on 404 errors:
($self, $response)
use LWP::UserAgent::Patch::Retry -criteria => sub { my ($self, $resp) = @_; return 1 if !$resp->is_success && $resp->code != 404; };
By patching, you do not need to replace all the client code which uses LWP::UserAgent (or WWW::Mechanize, and so on).
Please visit the project's homepage at https://metacpan.org/release/LWP-UserAgent-Patch-Retry.
Source repository is at https://github.com/perlancar/perl-LWP-UserAgent-Patch-Retry.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=LWP-UserAgent-Patch-Retry
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
LWP::UserAgent::Determined, LWP::UserAgent::ExponentialBackoff
Retry in general: Retry, Sub::Retry, Perinci::Sub::Property::retry
perlancar <perlancar@cpan.org>
This software is copyright (c) 2019, 2017, 2015, 2013 by perlancar@cpan.org.
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 LWP::UserAgent::Patch::Retry, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LWP::UserAgent::Patch::Retry
CPAN shell
perl -MCPAN -e shell install LWP::UserAgent::Patch::Retry
For more information on module installation, please visit the detailed CPAN module installation guide.