Retry/Types.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 1 totaltotal 93.0% 40 / 43 CC 2 SCAR 2.1
CC
2
Cov
94%
class_name
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Retry/Interval.pm ↑ Summary Retry/Interval/API.pm »
1 package AnyEvent::Retry::Types;
2 4 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 $AnyEvent::Retry::Types::VERSION = '0.03';
4 }
5 # ABSTRACT: Types used internally by C<AnyEvent::Retry>
6 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use true;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶use MooseX::Types -declare => ['Interval'];
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use MooseX::Types::Moose qw(Str HashRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 4 role_type Interval, { role => 'AnyEvent::Retry::Interval::API' };
14  
15 6 ▶sub class_name {
Subroutine class_name: called CC=2 SCAR=7.6
Pod undocumented
16 6 my $str = shift;
17 6 ▶ if(/^\+(.+)$/){
Branch: 1 branch
BranchTrueFalseTotal
if (/^\+(.+)$/) { } 0 6 6
18 0 return $1;
19 }
20 else {
21 6 return "AnyEvent::Retry::Interval::$str";
22 }
23 }
24  
25 1 ▶coerce Interval, from Str, via {
Subroutine __ANON__: called CC=1 SCAR=0.0
26 1 my $name = class_name($_);
27 1 Class::MOP::load_class($name);
28 1 return $name->new;
29 4 };
30  
31 5 ▶coerce Interval, from HashRef, via {
Subroutine __ANON__: called CC=1 SCAR=0.0
32 5 my $req = [keys %$_]->[0];
33 5 my $args = $_->{$req};
34  
35 5 my $name = class_name($req);
36 5 Class::MOP::load_class($name);
37 5 return $name->new($args);
38 4 };
39  
40 __END__
« Retry/Interval.pm ↑ Summary Retry/Interval/API.pm »