Catmandu/Fix/sum.pm

filter: Statementstmt 100% 31 / 31 Branchbran 100% 2 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 95.6% 44 / 46 CC 3 SCAR 4.1
CC
3
Cov
97%
__ANON__
3.0
_build_fixer
1.0
BEGIN
1.0
CRAP 1.5
« Catmandu/Fix/validate.pm ↑ Summary Catmandu/Fix/Condition/Builder/Simple.pm »
1 package Catmandu::Fix::sum;
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 Catmandu::Util qw(is_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Catmandu::Util::Path qw(as_path);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use List::Util qw(all sum);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 with 'Catmandu::Fix::Builder';
15  
16 1 has path => (fix_arg => 1);
17  
18 5 ▶sub _build_fixer {
Subroutine _build_fixer: called CC=1 SCAR=0.0
19 5 my ($self) = @_;
20 as_path($self->path)->updater(
21 5 ▶ if_array_ref => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
22 5 my $val = $_[0];
23 5 ▶ return undef, 1 unless all {is_number($_)} @$val;
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
unless &all(sub { is_number($_); } , @$val) 1 4 5
24 4 ▶ sum(@$val) // 0;
Condition50%1/2
&sum(@$val) // 0
l!l
40
MC/DC0%0/1
&sum(@$val) // 0
&sum(@$val)
Truth table50%1/2
A
A= &sum(@$val)
Aresult
11
00
25 }
26 5 );
27 }
28  
29 1 1;
30  
31 __END__
« Catmandu/Fix/validate.pm ↑ Summary Catmandu/Fix/Condition/Builder/Simple.pm »