Retry/Strategy/HelperRole/SleepCapping.pm

filter: Statementstmt 73.3% 11 / 15 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod n/a totaltotal 61.9% 13 / 21 CC 2 SCAR 11.6
CC
2
Cov
65%
__ANON__
6.0
__ANON__
2.0
BEGIN
1.0
CRAP 3.2
« Retry.pm ↑ Summary Retry/Strategy/HelperRole/SleepTimeout.pm »
1 #
2 # This file is part of Action-Retry
3 #
4 # This software is copyright (c) 2013 by Damien "dams" Krotkine.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 package Action::Retry::Strategy::HelperRole::SleepCapping;
10 {
11 1 $Action::Retry::Strategy::HelperRole::SleepCapping::VERSION = '0.24';
12 }
13  
14 # ABSTRACT: Helper to be consumed by Action::Retry Strategies, to enable capping the sleep time
15  
16 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use List::Util qw(min);
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 has capped_sleep_time => (
21 is => 'ro',
22 lazy => 1,
23 0 ▶ default => sub { undef },
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 1 );
25  
26 0 ▶around compute_sleep_time => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
27 0 my $orig = shift;
28 0 my $self = shift;
29
30 0 ▶ return defined $self->capped_sleep_time
Branch: 1 branch
BranchTrueFalseTotal
defined $self->capped_sleep_time ? : 0 0 0
31 ? min($orig->($self, @_), $self->capped_sleep_time)
32 : $orig->($self, @_);
33  
34 1 };
35  
36 1 1;
37  
38 __END__
« Retry.pm ↑ Summary Retry/Strategy/HelperRole/SleepTimeout.pm »