Catmandu/Fix/eval.pm

filter: Statementstmt 100% 40 / 40 Branchbran 100% 4 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 96.6% 58 / 60 CC 5 SCAR 8.5
CC
5
Cov
98%
__ANON__
5.0
__ANON__
1.0
_build_fixer
1.0
CRAP 2.3
« Catmandu/Plugin/Readonly.pm ↑ Summary Catmandu/Fix/lookup.pm »
1 package Catmandu::Fix::eval;
2  
3 1 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '1.2025';
6  
7 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use List::Util qw(all);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Catmandu::Fix;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Catmandu::Util qw(is_string is_array_ref);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Catmandu::Util::Path qw(as_path);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 has path => (fix_arg => 1);
16  
17 1 with 'Catmandu::Fix::Builder';
18  
19 5 ▶sub _build_fixer {
Subroutine _build_fixer: called CC=1 SCAR=0.0
20 5 my ($self) = @_;
21 5 my $getter = as_path($self->path)->getter;
22 5 ▶ sub {
Subroutine __ANON__: called CC=5 SCAR=16.1
23 5 my $data = $_[0];
24 5 for my $fixes (@{$getter->($data)}) {
25 4 ▶ $fixes = [$fixes] unless is_array_ref($fixes);
Branch: 1 branch
BranchTrueFalseTotal
unless is_array_ref($fixes) 2 2 4
26 4 ▶ next unless @$fixes && all {is_string($_)} @$fixes;
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
unless @$fixes and &all(sub { is_string($_); } , @$fixes) 1 3 4
Condition66%2/3
@$fixes and &all(sub { is_string($_); } , @$fixes)
!ll&&!rl&&r
013
MC/DC50%1/2
@$fixes and &all(sub { is_string($_); } , @$fixes)
@$fixes &all(sub { is_string($_); } , @$fixes)
Truth table66%2/3
A and B
A= @$fixesB= &all(sub { is_string($_); } , @$fixes)
ABresult
0X0
100
111
27 3 my $fixer = Catmandu::Fix->new(fixes => $fixes);
28 3 $data = $fixer->fix($data);
29 }
30 5 $data;
31 5 };
32 }
33  
34 1 1;
35  
36 __END__
« Catmandu/Plugin/Readonly.pm ↑ Summary Catmandu/Fix/lookup.pm »