Guess/Role/DateTime.pm

filter: Statementstmt 62.0% 18 / 29 Branchbran 16.6% 1 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 57.1% 24 / 42 CC 4 SCAR 11.8
CC
4
Cov
54%
parser_class
5.7
__ANON__
3.7
__ANON__
2.0
CRAP 3.3
« Guess/Role/Tiny.pm ↑ Summary check_prereqs.pl »
1 package Type::Guess::Role::DateTime;
2  
3 3 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use Module::Runtime qw(require_module);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 my $_parser = {
9 parser_class => "DateTime::Format::Flexible",
10 parser_opts => [],
11 parser_method => "parse_datetime"
12 };
13  
14  
15 3 ▶sub parser_class {
Subroutine parser_class: called CC=3 SCAR=17.3
Pod undocumented
16 3 my $self = shift;
17 3 my @keys = qw/parser_class parser_opts parser_method/;
18 3 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 3 3
19 0 my @args = @_;
20 0 my %args;
21 0 ▶ $args[0] = "DateTime::Format::" . $args[0] unless $args[0] =~ /^DateTime::Format::/;
Branch: 1 branch
BranchTrueFalseTotal
unless $args[0] =~ /^DateTime::Format::/ 0 0 0
22 0 @args{@keys} = @args;
23 0 $_parser = { %$_parser, %args };
24 }
25 3 require_module $_parser->{parser_class};
26 0 return map { $_parser->{$_} } qw/parser_class parser_opts parser_method/;
27 }
28  
29 3 ▶around '_type' => sub {
Subroutine __ANON__: called CC=2 SCAR=13.0
30 3 my ($orig, $class, @vals) = @_;
31  
32 3 my ($parser_class, $parser_opts, $parser_method) = $class->parser_class;
33 0 ▶ return "DateTime" if $class->_enough(sub { eval { $parser_class->$parser_method($_, $parser_opts->@*) } }, @vals);
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if $class->_enough(sub { eval { do { $parser_class->$parser_method($_, @$parser_opts) } }; } , @vals) 0 0 0
34 0 return $orig->($class, @vals);
35 3 };
36  
37  
38 3 1
39  
« Guess/Role/Tiny.pm ↑ Summary check_prereqs.pl »