Catmandu/Path.pm

filter: Statementstmt 100% 38 / 38 Branchbran 92.8% 13 / 14 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 98.3% 59 / 60 CC 10 SCAR 18.4
CC
10
Cov
98%
__ANON__
9.0
__ANON__
2.0
BEGIN
1.0
CRAP 6.3
« Catmandu/Fix/Bind/timeout.pm ↑ Summary Catmandu/Importer.pm »
1 package Catmandu::Path;
2  
3 95 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 95 our $VERSION = '1.2025';
6  
7 95 ▶use Catmandu::Util qw(is_array_ref is_code_ref);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 95 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 95 has path => (is => 'ro', required => 1);
11  
12 95 requires 'getter';
13 95 requires 'setter';
14 95 requires 'creator';
15 95 requires 'updater';
16 95 requires 'deleter';
17  
18 201 ▶around creator => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
19 201 my $orig = shift;
20 201 my $self = shift;
21 201 ▶ my %opts = @_ == 1 ? (value => $_[0]) : @_;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 ? : 119 82 201
22  
23 201 $orig->($self, %opts);
24 95 };
25  
26 151 ▶around updater => sub {
Subroutine __ANON__: called CC=9 SCAR=22.0
27 151 my $orig = shift;
28 151 my $self = shift;
29 151 ▶ my %opts = @_ == 1 ? (value => $_[0]) : @_;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 ? : 40 111 151
30  
31 151 for my $key (keys %opts) {
32 164 my $val = $opts{$key};
33 164 ▶ next unless $key =~ s/^if_//;
Branch: 1 branch
BranchTrueFalseTotal
unless $key =~ s/^if_// 52 112 164
34 112 ▶ push @{$opts{if} ||= []}, $key, $val;
Condition100%2/2
$opts{"if"} ||= []
l!l
1399
MC/DC100%1/1
$opts{"if"} ||= []
$opts{"if"}
Truth table100%2/2
A
A= $opts{"if"}
Aresult
11
00
35 }
36  
37 151 ▶ if (my $tests = $opts{if}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $tests = $opts{"if"}) 111 40 151
38 111 ▶ for (my $i = 0; $i < @$tests; $i += 2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @$tests) 128 111 239
39 128 my $test = $tests->[$i];
40 128 ▶ $test = [$test] unless is_array_ref($test);
Branch: 1 branch
BranchTrueFalseTotal
unless is_array_ref($test) 120 8 128
41 $tests->[$i]
42 128 ▶ = [map {is_code_ref($_) ? $_ : Catmandu::Util->can("is_$_")}
Branch: 1 branch
BranchTrueFalseTotal
is_code_ref($_) ? : 0 138 138
43 @$test];
44 }
45 }
46  
47 151 $orig->($self, %opts);
48 95 };
49  
50 95 1;
51  
52 __END__
« Catmandu/Fix/Bind/timeout.pm ↑ Summary Catmandu/Importer.pm »