NAME

LWP::UserAgent::ExponentialBackoff - LWP::UserAgent extension that retries errors with exponential backoff

SYNOPSIS

  my @failCodes    = qw(500 503);
  my %failCodesMap = map { $_ => $_ } @failCodes;

  %options = (
  	  tolerance    => .20,
	  retryCount   => 5,
	  minBackoff   => 3,
	  maxBackoff   => 120,
	  deltaBackoff => 3,
	  failCodes    => \%failCodesMap
  );

  my $ua = LWP::UserAgent::ExponentialBackoff->new(%options);
  my $request   = HTTP::Request->new( 'GET', $uri );
  my $response  = $ua->request($request);

DESCRIPTION

LWP::UserAgent::ExponentialBackoff is a LWP::UserAgent extention. It retries requests on error using an exponential backoff algorthim.

CONSTRUCTOR METHODS

The following constructor methods are available:

$ua = LWP::UserAgent::ExponentialBackoff->new( %options )

This method constructs a new LWP::UserAgent::ExponentialBackoff object and returns it. Key/value pair arguments may be provided to set up the initial state.

KEY                     DEFAULT
-----------             --------------------
sum                     undef
retryCount              3
minBackoff              3
maxBackoff              90
tolerance               .20
deltaBackoff            3
failCodes               { map { $_ => $_ } qw(408 500 502 503 504) }	

See LWP::UserAgent for additional key/value pair arguments that may be provided.

METHODS

This module inherits all of LWP::UserAgent's methods, and adds the following.

    TBD

IMPLEMENTATION

This class works by overriding LWP::UserAgent's Csimple_request method with an exponential backoff algortihm.

SEE ALSO

LWP, LWP::UserAgent, LWP::UserAgent::Determined

AUTHOR

Michael Marrotte <lt>marrotte at cpan dot org<gt>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 192:

You forgot a '=back' before '=head1'

Around line 201:

You forgot a '=back' before '=head1'