lib/Catmandu/Fix/Bind/mab_each.pm

filter: Statementstmt 100% 26 / 26 Branchbran 50.0% 3 / 6 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 2 totaltotal 76.0% 35 / 46 CC 7 SCAR 17.5
CC
7
Cov
84%
bind
7.8
BEGIN
1.0
BEGIN
1.0
CRAP 5.7
« lib/MAB2/Parser/XML.pm ↑ Summary script/mab2_convert.pl »
1 package Catmandu::Fix::Bind::mab_each;
2  
3 1 our $VERSION = '0.24';
4  
5 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Catmandu::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 with 'Catmandu::Fix::Bind', 'Catmandu::Fix::Bind::Group';
9  
10 1 has done => (is => 'ro');
11  
12 1 ▶sub unit {
Subroutine unit: called CC=1 SCAR=0.0
Pod undocumented
13 1 my ($self,$data) = @_;
14 1 $self->{done} = 0;
15 1 $data;
16 }
17  
18 1 ▶sub bind {
Subroutine bind: called CC=7 SCAR=20.5
Pod undocumented
19 1 my ($self,$mvar,$code) = @_;
20  
21 1 ▶ return $mvar if $self->done;
Branch: 1 branch
BranchTrueFalseTotal
if $self->done 0 1 1
22  
23 1 ▶ my $rows = $mvar->{record} // [];
Condition50%1/2
$mvar->{"record"} // []
l!l
10
MC/DC0%0/1
$mvar->{"record"} // []
$mvar->{"record"}
Truth table50%1/2
A
A= $mvar->{"record"}
Aresult
11
00
24  
25 1 my @new = ();
26  
27 1 for my $row (@{$rows}) {
28  
29 70 $mvar->{record} = [$row];
30  
31 70 my $fixed = $code->($mvar);
32  
33 70 ▶ push @new , @{$fixed->{record}} if defined($fixed) && exists $fixed->{record};
Branch: 1 branch
BranchTrueFalseTotal
if defined $fixed and exists $fixed->{"record"} 70 0 70
Condition33%1/3
defined $fixed and exists $fixed->{"record"}
!ll&&!rl&&r
0070
MC/DC0%0/2
defined $fixed and exists $fixed->{"record"}
defined $fixed exists $fixed->{"record"}
Truth table33%1/3
A and B
A= defined $fixedB= exists $fixed->{"record"}
ABresult
0X0
100
111
34 }
35  
36 1 ▶ $mvar->{record} = \@new if exists $mvar->{record};
Branch: 1 branch
BranchTrueFalseTotal
if exists $mvar->{"record"} 1 0 1
37  
38 1 $self->{done} = 1;
39  
40 1 $mvar;
41 }
42  
43  
44 1 1;
45  
46 __END__
« lib/MAB2/Parser/XML.pm ↑ Summary script/mab2_convert.pl »