Action-Retry

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

  },
  "configure_requires" => {
    "ExtUtils::MakeMaker" => "6.30",
    "Module::Build" => "0.3601"
  },
  "dist_abstract" => "Module to try to perform an action, with various ways of retrying and sleeping between retries.",
  "dist_author" => [
    "Damien \"dams\" Krotkine"
  ],
  "dist_name" => "Action-Retry",
  "dist_version" => "0.24",
  "license" => "perl",
  "module_name" => "Action::Retry",
  "recommends" => {},
  "recursive_test_files" => 1,
  "requires" => {
    "Math::Fibonacci" => 0,
    "Module::Runtime" => 0,
    "Moo" => 0,
    "Scalar::Util" => 0,
    "Time::HiRes" => 0

Changes  view on Meta::CPAN

0.24      2014-05-21 15:53:27 Europe/Amsterdam

  * fix typo

0.23      2013-12-24 02:06:03 Europe/Paris
  * *really* don't depend on namespace::autoclean, duh...

0.22      2013-12-21 23:46:15 Europe/Amsterdam
  * don't depend on Test::Most, Test::Pretty and namespace::autoclean

0.21      2013-02-11 11:47:44 Europe/Paris

META.yml  view on Meta::CPAN

dynamic_config: 0
generated_by: 'Dist::Zilla version 5.005, CPAN::Meta::Converter version 2.132830'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: 1.4
name: Action-Retry
provides:
  Action::Retry:
    file: lib/Action/Retry.pm
    version: 0.24
  Action::Retry::Strategy:
    file: lib/Action/Retry/Strategy.pm
    version: 0.24
  Action::Retry::Strategy::Constant:
    file: lib/Action/Retry/Strategy/Constant.pm
    version: 0.24
  Action::Retry::Strategy::Fibonacci:
    file: lib/Action/Retry/Strategy/Fibonacci.pm
    version: 0.24
  Action::Retry::Strategy::HelperRole::RetriesLimit:
    file: lib/Action/Retry/Strategy/HelperRole/RetriesLimit.pm
    version: 0.24
  Action::Retry::Strategy::HelperRole::SleepCapping:
    file: lib/Action/Retry/Strategy/HelperRole/SleepCapping.pm
    version: 0.24
  Action::Retry::Strategy::HelperRole::SleepTimeout:
    file: lib/Action/Retry/Strategy/HelperRole/SleepTimeout.pm
    version: 0.24
  Action::Retry::Strategy::Linear:
    file: lib/Action/Retry/Strategy/Linear.pm
    version: 0.24
requires:
  Math::Fibonacci: 0
  Module::Runtime: 0
  Moo: 0
  Scalar::Util: 0
  Time::HiRes: 0
resources:
  repository: git://github.com/dams/Action-Retry.git
version: 0.24

Makefile.PL  view on Meta::CPAN

    "Moo" => 0,
    "Scalar::Util" => 0,
    "Time::HiRes" => 0
  },
  "TEST_REQUIRES" => {
    "File::Spec" => 0,
    "IO::Handle" => 0,
    "IPC::Open3" => 0,
    "Test::More" => 0
  },
  "VERSION" => "0.24",
  "test" => {
    "TESTS" => "t/*.t"
  }
);


my %FallbackPrereqs = (
  "File::Spec" => 0,
  "IO::Handle" => 0,
  "IPC::Open3" => 0,

README  view on Meta::CPAN



This archive contains the distribution Action-Retry,
version 0.24:

  Module to try to perform an action, with various ways of retrying and sleeping between retries.

This software is copyright (c) 2013 by Damien "dams" Krotkine.

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


lib/Action/Retry.pm  view on Meta::CPAN

#
# This file is part of Action-Retry
#
# This software is copyright (c) 2013 by Damien "dams" Krotkine.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
package Action::Retry;
{
  $Action::Retry::VERSION = '0.24';
}

# ABSTRACT: Module to try to perform an action, with various ways of retrying and sleeping between retries.

use Module::Runtime qw(use_module);
use Scalar::Util qw(blessed);
use Time::HiRes qw(usleep gettimeofday);
use Carp;

use base 'Exporter';

lib/Action/Retry.pm  view on Meta::CPAN

=pod

=encoding UTF-8

=head1 NAME

Action::Retry - Module to try to perform an action, with various ways of retrying and sleeping between retries.

=head1 VERSION

version 0.24

=head1 SYNOPSIS

  # Simple usage, will attempt to run the code, retrying if it dies, retrying
  # 10 times max, sleeping 1 second between retries

  # functional interface
  use Action::Retry qw(retry);
  retry { do_stuff };
 

lib/Action/Retry/Strategy.pm  view on Meta::CPAN

#
# This file is part of Action-Retry
#
# This software is copyright (c) 2013 by Damien "dams" Krotkine.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
package Action::Retry::Strategy;
{
  $Action::Retry::Strategy::VERSION = '0.24';
}

# ABSTRACT: Srategy role that any Action::Retry strategy should consume

use Moo::Role;

requires 'needs_to_retry';
requires 'compute_sleep_time';
requires 'next_step';
requires 'reset';

lib/Action/Retry/Strategy.pm  view on Meta::CPAN

=pod

=encoding UTF-8

=head1 NAME

Action::Retry::Strategy - Srategy role that any Action::Retry strategy should consume

=head1 VERSION

version 0.24

=head1 AUTHOR

Damien "dams" Krotkine

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Damien "dams" Krotkine.

This is free software; you can redistribute it and/or modify it under

lib/Action/Retry/Strategy/Constant.pm  view on Meta::CPAN

#
# This file is part of Action-Retry
#
# This software is copyright (c) 2013 by Damien "dams" Krotkine.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
package Action::Retry::Strategy::Constant;
{
  $Action::Retry::Strategy::Constant::VERSION = '0.24';
}

# ABSTRACT: Constant sleep time strategy

use Moo;


with 'Action::Retry::Strategy';
with 'Action::Retry::Strategy::HelperRole::RetriesLimit';

lib/Action/Retry/Strategy/Constant.pm  view on Meta::CPAN

=pod

=encoding UTF-8

=head1 NAME

Action::Retry::Strategy::Constant - Constant sleep time strategy

=head1 VERSION

version 0.24

=head1 SYNOPSIS

To be used as strategy in L<Action::Retry>

=head1 ATTRIBUTES

=head2 sleep_time

  ro, Int, defaults to 1000 ( 1 second )

lib/Action/Retry/Strategy/Fibonacci.pm  view on Meta::CPAN

#
# This file is part of Action-Retry
#
# This software is copyright (c) 2013 by Damien "dams" Krotkine.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
package Action::Retry::Strategy::Fibonacci;
{
  $Action::Retry::Strategy::Fibonacci::VERSION = '0.24';
}

# ABSTRACT: Fibonacci incrementation of sleep time strategy

use Math::Fibonacci qw(term);

use Moo;



lib/Action/Retry/Strategy/Fibonacci.pm  view on Meta::CPAN

=pod

=encoding UTF-8

=head1 NAME

Action::Retry::Strategy::Fibonacci - Fibonacci incrementation of sleep time strategy

=head1 VERSION

version 0.24

=head1 SYNOPSIS

To be used as strategy in L<Action::Retry>

=head1 DESCRIPTION

Sleeps incrementally by following the Fibonacci sequence : F(i) = F(i-1) +
F(i-2) starting from 0,1. By default F(0) = 0, F(1) = 1, F(2) = 1, F(3) = 2

lib/Action/Retry/Strategy/HelperRole/RetriesLimit.pm  view on Meta::CPAN

#
# This file is part of Action-Retry
#
# This software is copyright (c) 2013 by Damien "dams" Krotkine.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
package Action::Retry::Strategy::HelperRole::RetriesLimit;
{
  $Action::Retry::Strategy::HelperRole::RetriesLimit::VERSION = '0.24';
}

# ABSTRACT: Helper to be consumed by Action::Retry Strategies, to enable giving up retrying after a number of retries

use Moo::Role;

has max_retries_number => (
    is => 'ro',
    lazy => 1,
    default => sub { 10 },

lib/Action/Retry/Strategy/HelperRole/RetriesLimit.pm  view on Meta::CPAN

=pod

=encoding UTF-8

=head1 NAME

Action::Retry::Strategy::HelperRole::RetriesLimit - Helper to be consumed by Action::Retry Strategies, to enable giving up retrying after a number of retries

=head1 VERSION

version 0.24

=head1 AUTHOR

Damien "dams" Krotkine

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Damien "dams" Krotkine.

This is free software; you can redistribute it and/or modify it under

lib/Action/Retry/Strategy/HelperRole/SleepCapping.pm  view on Meta::CPAN

#
# This file is part of Action-Retry
#
# This software is copyright (c) 2013 by Damien "dams" Krotkine.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
package Action::Retry::Strategy::HelperRole::SleepCapping;
{
  $Action::Retry::Strategy::HelperRole::SleepCapping::VERSION = '0.24';
}

# ABSTRACT: Helper to be consumed by Action::Retry Strategies, to enable capping the sleep time

use Moo::Role;

use List::Util qw(min);

has capped_sleep_time => (
    is => 'ro',

lib/Action/Retry/Strategy/HelperRole/SleepCapping.pm  view on Meta::CPAN

=pod

=encoding UTF-8

=head1 NAME

Action::Retry::Strategy::HelperRole::SleepCapping - Helper to be consumed by Action::Retry Strategies, to enable capping the sleep time

=head1 VERSION

version 0.24

=head1 AUTHOR

Damien "dams" Krotkine

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Damien "dams" Krotkine.

This is free software; you can redistribute it and/or modify it under

lib/Action/Retry/Strategy/HelperRole/SleepTimeout.pm  view on Meta::CPAN

#
# This file is part of Action-Retry
#
# This software is copyright (c) 2013 by Damien "dams" Krotkine.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
package Action::Retry::Strategy::HelperRole::SleepTimeout;
{
  $Action::Retry::Strategy::HelperRole::SleepTimeout::VERSION = '0.24';
}

# ABSTRACT: Helper to be consumed by Action::Retry Strategies, to enable giving up retrying when the sleep_time is too big

use Moo::Role;

has max_sleep_time => (
    is => 'ro',
    lazy => 1,
    default => sub { undef },

lib/Action/Retry/Strategy/HelperRole/SleepTimeout.pm  view on Meta::CPAN

=pod

=encoding UTF-8

=head1 NAME

Action::Retry::Strategy::HelperRole::SleepTimeout - Helper to be consumed by Action::Retry Strategies, to enable giving up retrying when the sleep_time is too big

=head1 VERSION

version 0.24

=head1 AUTHOR

Damien "dams" Krotkine

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Damien "dams" Krotkine.

This is free software; you can redistribute it and/or modify it under

lib/Action/Retry/Strategy/Linear.pm  view on Meta::CPAN

#
# This file is part of Action-Retry
#
# This software is copyright (c) 2013 by Damien "dams" Krotkine.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
package Action::Retry::Strategy::Linear;
{
  $Action::Retry::Strategy::Linear::VERSION = '0.24';
}

# ABSTRACT: Linear incrementation of sleep time strategy

use Moo;


with 'Action::Retry::Strategy';
with 'Action::Retry::Strategy::HelperRole::RetriesLimit';
with 'Action::Retry::Strategy::HelperRole::SleepTimeout';

lib/Action/Retry/Strategy/Linear.pm  view on Meta::CPAN

=pod

=encoding UTF-8

=head1 NAME

Action::Retry::Strategy::Linear - Linear incrementation of sleep time strategy

=head1 VERSION

version 0.24

=head1 SYNOPSIS

To be used as strategy in L<Action::Retry>

=head1 ATTRIBUTES

=head2 initial_sleep_time

  ro, Int, defaults to 1000 ( 1 second )



( run in 0.425 second using v1.01-cache-2.11-cpan-7add2cbd662 )