The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTTP::Retry - Wrapped HTTP::Tiny with timeout and retry

SYNOPSIS

  use HTTP::Retry qw(http);
  $response = http("http://www.example.com");
  $response = http('url' => 'http://www.example.com', 'timeout' => 1, 'retry' => 10, 'sleep' => 1);
  print $response->{status};
  print $response->{content} if $response->{success};

DESCRIPTION

Another HTTP client library.

LWP is too complex and too slow.

HTTP::Tiny and Furl is wonderful, but no autoretry.

HTTP::Retry resolves this, then make your code clearer.

Enjoy it!

EASY MODE

Easy write and understand with 3 seconds timeout and 3 times retry.

  my $response = http("http://www.example.com");
  print $response->{content};

COMPLEX MODE

Set timeout and retry times as your wish.

  my $response = http('url' => 'http://www.example.com', 'timeout' => 1, 'retry' => 10, 'sleep' => 1);
  print $response->{content};

SEE ALSO

HTTP::Tiny, Furl, Hijk

AUTHOR

Chen Gang, <yikuyiku.com@google.com>

COPYRIGHT AND LICENSE

Copyright (C) 2014 by Chen Gang

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.16.2 or, at your option, any later version of Perl 5 you may have available.