Action-CircuitBreaker

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      },
      "test" : {
         "recommends" : {
            "CPAN::Meta" : "2.120900"
         },
         "requires" : {
            "Action::Retry" : "0",
            "ExtUtils::MakeMaker" : "0",
            "File::Spec" : "0",
            "Test::More" : "0",
            "Try::Tiny" : "0"
         }
      }
   },
   "provides" : {
      "Action::CircuitBreaker" : {
         "file" : "lib/Action/CircuitBreaker.pm",
         "version" : "0.1"
      }
   },
   "release_status" : "stable",

META.yml  view on Meta::CPAN

---
abstract: 'Module to try to perform an action, with an option to suspend execution after a number of failures.'
author:
  - hangy
build_requires:
  Action::Retry: '0'
  ExtUtils::MakeMaker: '0'
  File::Spec: '0'
  Test::More: '0'
  Try::Tiny: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: Action-CircuitBreaker
no_index:

Makefile.PL  view on Meta::CPAN

  "PREREQ_PM" => {
    "Moo" => 0,
    "Scalar::Util" => 0,
    "Time::HiRes" => 0
  },
  "TEST_REQUIRES" => {
    "Action::Retry" => 0,
    "ExtUtils::MakeMaker" => 0,
    "File::Spec" => 0,
    "Test::More" => 0,
    "Try::Tiny" => 0
  },
  "VERSION" => "0.1",
  "test" => {
    "TESTS" => "t/*.t"
  }
);


my %FallbackPrereqs = (
  "Action::Retry" => 0,
  "ExtUtils::MakeMaker" => 0,
  "File::Spec" => 0,
  "Moo" => 0,
  "Scalar::Util" => 0,
  "Test::More" => 0,
  "Time::HiRes" => 0,
  "Try::Tiny" => 0
);


unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
  delete $WriteMakefileArgs{TEST_REQUIRES};
  delete $WriteMakefileArgs{BUILD_REQUIRES};
  $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}

delete $WriteMakefileArgs{CONFIGURE_REQUIRES}

dist.ini  view on Meta::CPAN

main_module = lib/Action/CircuitBreaker.pm
version = 0.1

[Prereqs]
Moo = 0
Time::HiRes = 0
Scalar::Util = 0

[Prereqs / TestRequires]
Test::More = 0
Try::Tiny = 0
Action::Retry = 0

[Git::GatherDir]
[@Starter]
-remove = GatherDir

[GithubMeta]
issues = 1
user   = hangy
[@Git]

t/00-report-prereqs.dd  view on Meta::CPAN

                    },
       'test' => {
                   'recommends' => {
                                     'CPAN::Meta' => '2.120900'
                                   },
                   'requires' => {
                                   'Action::Retry' => '0',
                                   'ExtUtils::MakeMaker' => '0',
                                   'File::Spec' => '0',
                                   'Test::More' => '0',
                                   'Try::Tiny' => '0'
                                 }
                 }
     };
  $x;
 }

t/10-unit.t  view on Meta::CPAN

use Action::CircuitBreaker;

use strict;
use warnings;

use Test::More;

use Try::Tiny;

{
    my $var = 0;
    my $action = Action::CircuitBreaker->new();
    for my $x (0 .. 10) {
        try {
            $action->run(sub { $var++; die "plop" });
        } catch {
            # That's OK
        };

t/20-retry.t  view on Meta::CPAN

use Action::CircuitBreaker;

use strict;
use warnings;

use Test::More;

use Try::Tiny;
use Action::Retry;

{
    my $died = 0;
    my $action = Action::CircuitBreaker->new(max_retries_number => 9);
    try {
      my $foo = Action::Retry->new(
          attempt_code => sub { $action->run(sub { die "plop"; }) }, # ie. the database failed
          on_failure_code => sub { my ($error, $h) = @_; die $error; }, # by default Action::Retry would return undef
      )->run();



( run in 0.829 second using v1.01-cache-2.11-cpan-0d8aa00de5b )