Catmandu/Fix/int.pm

filter: Statementstmt 100% 30 / 30 Branchbran 100% 6 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 95.9% 47 / 49 CC 5 SCAR 9.8
CC
5
Cov
97%
__ANON__
5.0
_build_fixer
1.0
BEGIN
1.0
CRAP 2.7
« Catmandu/Fix/Bind/list.pm ↑ Summary Catmandu/Fix/disassoc.pm »
1 package Catmandu::Fix::int;
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 Catmandu::Util qw(is_string is_array_ref is_hash_ref);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Catmandu::Util::Path qw(as_path);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 has path => (fix_arg => 1);
14  
15 1 with 'Catmandu::Fix::Builder';
16  
17 14 ▶sub _build_fixer {
Subroutine _build_fixer: called CC=1 SCAR=0.0
18 14 my ($self) = @_;
19  
20 as_path($self->path)->updater(
21 13 ▶ sub {
Subroutine __ANON__: called CC=5 SCAR=16.1
22 13 my $val = $_[0];
23 13 ▶ if (is_string($val) and my ($num) = $val =~ /([+-]?[0-9]+)/) {
Branch: 3 branches
BranchTrueFalseTotal
if (is_string($val) and my($num) = $val =~ /([+-]?[0-9]+)/) { } 6 7 13
elsif (is_array_ref($val)) { } 3 4 7
elsif (is_hash_ref($val)) { } 3 1 4
Condition66%2/3
is_string($val) and my($num) = $val =~ /([+-]?[0-9]+)/
!ll&&!rl&&r
706
MC/DC50%1/2
is_string($val) and my($num) = $val =~ /([+-]?[0-9]+)/
is_string($val) my($num) = $val =~ /([+-]?[0-9]+)/
Truth table66%2/3
A and B
A= is_string($val)B= my($num) = $val =~ /([+-]?[0-9]+)/
ABresult
0X0
100
111
24 6 $num + 0;
25 }
26 elsif (is_array_ref($val)) {
27 3 scalar(@$val);
28 }
29 elsif (is_hash_ref($val)) {
30 3 scalar(keys %$val);
31 }
32 else {
33 1 0;
34 }
35 }
36 14 );
37 }
38  
39 1 1;
40  
41 __END__
« Catmandu/Fix/Bind/list.pm ↑ Summary Catmandu/Fix/disassoc.pm »