SICI.pm

filter: Statementstmt 80.0% 140 / 175 Branchbran 46.4% 53 / 114 Conditioncond 49.2% 31 / 63 MC/DCmcdc 18.4% 7 / 38 Subroutinesub 100% 17 / 17 Podpod 100% 6 / 6 totaltotal 61.5% 254 / 413 CC 79 SCAR 57.8
CC
79
Cov
64%
parse
436.3
list_problems
7.7
is_valid
5.0
CRAP 322.4
↑ Summary SICI/ItemSegment.pm »
1  
2 package Biblio::SICI;
3 {
4 3 $Biblio::SICI::VERSION = '0.04';
5 }
6  
7 # ABSTRACT: Provides methods for assembling, parsing, manipulating and serialising SICIs
8  
9 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use Sub::Quote;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 3 ▶use Biblio::SICI::ItemSegment;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶use Biblio::SICI::ContributionSegment;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 ▶use Biblio::SICI::ControlSegment;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 3 ▶use Biblio::SICI::Util qw( calculate_check_char );
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22  
23 3 has 'item' => (
24 is => 'ro',
25 lazy => 1,
26 isa => quote_sub(q{ die unless ( defined $_[0] and $_[0]->isa('Biblio::SICI::ItemSegment') ) }),
27 builder =>
28 quote_sub(q{ my ($self) = @_; return Biblio::SICI::ItemSegment->new( _sici => $self ); }),
29 init_arg => undef,
30 );
31  
32  
33 3 has 'contribution' => (
34 is => 'ro',
35 lazy => 1,
36 isa => quote_sub(
37 q{ die unless ( defined $_[0] and $_[0]->isa('Biblio::SICI::ContributionSegment') ) }),
38 builder => quote_sub(
39 q{ my ($self) = @_; return Biblio::SICI::ContributionSegment->new( _sici => $self ); }),
40 init_arg => undef,
41 );
42  
43  
44 3 has 'control' => (
45 is => 'ro',
46 lazy => 1,
47 isa => quote_sub(
48 q{ my ($val) = @_; die unless ( defined $val and $val->isa('Biblio::SICI::ControlSegment') ) }
49 ),
50 builder => quote_sub(
51 q{ my ($self) = @_; return Biblio::SICI::ControlSegment->new( _sici => $self ); }),
52 init_arg => undef,
53 );
54  
55  
56 has 'mode' => (
57 is => 'rw',
58 isa => quote_sub(q{ my ($val) = @_; die unless ( $val eq 'strict' or $val eq 'lax' ) }),
59 required => 1,
60 2 ▶ coerce => sub {
Subroutine __ANON__: called CC=3 SCAR=13.3
61 2 my ($val) = @_;
62 2 $val = join( '', split( " ", lc($val) ) );
63 2 ▶ return $val if ( $val eq 'strict' or $val eq 'lax' );
Branch: 1 branch
BranchTrueFalseTotal
if $val eq "strict" or $val eq "lax" 2 0 2
Condition33%1/3
$val eq "strict" or $val eq "lax"
l!l&&r!l&&!r
020
MC/DC0%0/2
$val eq "strict" or $val eq "lax"
$val eq "strict" $val eq "lax"
Truth table33%1/3
A or B
A= $val eq "strict"B= $val eq "lax"
ABresult
1X1
011
000
64 0 return 'lax';
65 },
66 3 default => quote_sub(q{ "lax" }),
67 );
68  
69  
70 3 has 'parsedString' => ( is => 'rwp', init_arg => undef, );
71  
72  
73 58 ▶sub parse {
Subroutine parse: called CC=70 SCAR=60.8
Pod documented
74 58 my ( $self, $string ) = @_;
75 58 ▶ my $strictMode = $self->mode() eq 'strict' ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->mode eq 'strict' ? : 0 58 58
76  
77 58 ▶ if ( defined $string ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $string) 58 0 58
78 58 $string =~ s/\r/ /go;
79 58 $string =~ s/\n/ /go;
80 58 $string = join( '', split( " ", $string ) );
81 }
82  
83 58 ▶ unless ($string) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string) 0 58 58
84 0 ▶ $strictMode ? die 'no string to parse' : return ( undef, undef, ['no string to parse'] );
Branch: 1 branch
BranchTrueFalseTotal
$strictMode ? : 0 0 0
85 }
86 58 $self->_set_parsedString($string);
87  
88 58 my $checkChar = '';
89 58 ▶ if ( $string =~ /;([0-9])(?:-.)?\Z/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /;([0-9])(?:-.)?\Z/) 58 0 58
90 58 ▶ if ( "$1" ne "2" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ("$1" ne '2') { } 0 58 58
91 0 ▶ $strictMode
Branch: 1 branch
BranchTrueFalseTotal
$strictMode ? : 0 0 0
92 ? die 'unsupported SICI version'
93 : return ( undef, undef, ['unsupported SICI version'] );
94 }
95 else {
96 58 $self->control()->version(2);
97 58 ▶ if ( $string =~ s/;2-(.)\Z// ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/;2-(.)\Z//) 58 0 58
98 58 $checkChar = $1;
99 }
100 }
101 }
102  
103 58 my $parserProblems = [];
104  
105 58 my @chars = split( //, $string );
106 58 my $tmp = '';
107 58 ▶ while ( exists( $chars[0] ) and $chars[0] !~ /[(<]/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $chars[0] and not $chars[0] =~ /[(<]/) 522 58 580
Condition66%2/3
exists $chars[0] and not $chars[0] =~ /[(<]/
!ll&&!rl&&r
058522
MC/DC50%1/2
exists $chars[0] and not $chars[0] =~ /[(<]/
exists $chars[0] not $chars[0] =~ /[(<]/
Truth table66%2/3
A and not(B)
A= exists $chars[0]B= not $chars[0] =~ /[(<]/
ABresult
0X0
100
111
108 522 $tmp .= shift @chars;
109 }
110  
111 58 ▶ if ( $tmp and exists( $chars[0] ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tmp and exists $chars[0]) { } 58 0 58
Condition33%1/3
$tmp and exists $chars[0]
!ll&&!rl&&r
0058
MC/DC0%0/2
$tmp and exists $chars[0]
$tmp exists $chars[0]
Truth table33%1/3
A and B
A= $tmpB= exists $chars[0]
ABresult
0X0
100
111
112 58 ▶ if ( $chars[0] eq '(' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($chars[0] eq '(') { } 58 0 58
elsif ($chars[0] eq '<') { } 0 0 0
113  
114 # warn 'ISSN candidate: ' . $tmp;
115 58 $self->item()->issn($tmp);
116 58 shift @chars;
117 }
118 elsif ( $chars[0] eq '<' ) {
119 0 push @{$parserProblems}, "item information missing";
120  
121 # warn 'Missing item info';
122 # warn 'Enumeration candidate: ' . $tmp;
123 0 ▶ if ( $tmp =~ /\A([A-Z0-9\/]+):([A-Z0-9\/]+)(?::([+*]))?\Z/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($tmp =~ m[\A([A-Z0-9/]+):([A-Z0-9/]+)(?::([+*]))?\Z]) { } 0 0 0
elsif ($tmp) { } 0 0 0
124 0 $self->item()->volume($1);
125 0 $self->item()->issue($2);
126 0 ▶ $self->item()->supplOrIdx($3) if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
127 }
128 elsif ($tmp) {
129 0 $self->item()->enumeration($tmp);
130 }
131 0 shift @chars;
132 0 goto CONTRIB;
133 }
134 else {
135 0 ▶ $strictMode ? die 'unparsable string' : return ( undef, undef, ['unparsable string'] );
Branch: 1 branch
BranchTrueFalseTotal
$strictMode ? : 0 0 0
136 }
137 } ## end if ( $tmp and exists( ...))
138 else {
139 0 ▶ $strictMode ? die 'unparsable string' : return ( undef, undef, ['unparsable string'] );
Branch: 1 branch
BranchTrueFalseTotal
$strictMode ? : 0 0 0
140 }
141  
142 58 $tmp = '';
143 58 ▶ while ( exists( $chars[0] ) and $chars[0] ne ')' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $chars[0] and $chars[0] ne ")") 379 58 437
Condition66%2/3
exists $chars[0] and $chars[0] ne ")"
!ll&&!rl&&r
058379
MC/DC50%1/2
exists $chars[0] and $chars[0] ne ")"
exists $chars[0] $chars[0] ne ")"
Truth table66%2/3
A and B
A= exists $chars[0]B= $chars[0] ne ")"
ABresult
0X0
100
111
144 379 $tmp .= shift @chars;
145 }
146 58 ▶ if ( $tmp and exists( $chars[0] ) and $chars[0] eq ')' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($tmp and exists $chars[0] and $chars[0] eq ')') { } 57 1 58
elsif (exists $chars[0] and $chars[0] eq ')') { } 1 0 1
Condition66%4/6
$tmp and exists $chars[0] and $chars[0] eq ")"
!ll&&!rl&&r
1057
$tmp and exists $chars[0]
!ll&&!rl&&r
1057
MC/DC33%1/3
$tmp and exists $chars[0] and $chars[0] eq ")"
$tmp exists $chars[0] $chars[0] eq ")"
Truth table50%2/4
A and B and C
A= $tmpB= exists $chars[0]C= $chars[0] eq ")"
ABCresult
0XX0
10X0
1100
1111
147  
148 # warn 'Chronology candidate: ' . $tmp;
149 57 $self->item()->chronology($tmp);
150 57 shift @chars;
151 }
152 ▶ elsif ( exists( $chars[0] ) and $chars[0] eq ')' ) {
Condition33%1/3
exists $chars[0] and $chars[0] eq ")"
!ll&&!rl&&r
001
MC/DC0%0/2
exists $chars[0] and $chars[0] eq ")"
exists $chars[0] $chars[0] eq ")"
Truth table33%1/3
A and B
A= exists $chars[0]B= $chars[0] eq ")"
ABresult
0X0
100
111
153 1 shift @chars;
154 }
155 else {
156 0 ▶ $strictMode ? die 'unparsable string' : return ( undef, undef, ['unparsable string'] );
Branch: 1 branch
BranchTrueFalseTotal
$strictMode ? : 0 0 0
157 }
158  
159 58 $tmp = '';
160 58 ▶ while ( exists( $chars[0] ) and $chars[0] ne '<' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $chars[0] and $chars[0] ne "<") 218 58 276
Condition66%2/3
exists $chars[0] and $chars[0] ne "<"
!ll&&!rl&&r
058218
MC/DC50%1/2
exists $chars[0] and $chars[0] ne "<"
exists $chars[0] $chars[0] ne "<"
Truth table66%2/3
A and B
A= exists $chars[0]B= $chars[0] ne "<"
ABresult
0X0
100
111
161 218 $tmp .= shift @chars;
162 }
163 58 ▶ if ( $tmp and exists( $chars[0] ) and $chars[0] eq '<' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($tmp and exists $chars[0] and $chars[0] eq '<') { } 55 3 58
elsif (exists $chars[0] and $chars[0] eq '<') { } 3 0 3
Condition66%4/6
$tmp and exists $chars[0] and $chars[0] eq "<"
!ll&&!rl&&r
3055
$tmp and exists $chars[0]
!ll&&!rl&&r
3055
MC/DC33%1/3
$tmp and exists $chars[0] and $chars[0] eq "<"
$tmp exists $chars[0] $chars[0] eq "<"
Truth table50%2/4
A and B and C
A= $tmpB= exists $chars[0]C= $chars[0] eq "<"
ABCresult
0XX0
10X0
1100
1111
164  
165 # warn 'Enumeration candidate: ' . $tmp;
166 55 ▶ if ( $tmp =~ /\A([A-Z0-9\/]+):([A-Z0-9\/]+)(?::([+*]))?\Z/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($tmp =~ m[\A([A-Z0-9/]+):([A-Z0-9/]+)(?::([+*]))?\Z]) { } 39 16 55
elsif ($tmp) { } 16 0 16
167 39 $self->item()->volume($1);
168 39 $self->item()->issue($2);
169 39 ▶ $self->item()->supplOrIdx($3) if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 39 39
170 }
171 elsif ($tmp) {
172 16 $self->item()->enumeration($tmp);
173 }
174 55 shift @chars;
175 }
176 ▶ elsif ( exists( $chars[0] ) and $chars[0] eq '<' ) {
Condition33%1/3
exists $chars[0] and $chars[0] eq "<"
!ll&&!rl&&r
003
MC/DC0%0/2
exists $chars[0] and $chars[0] eq "<"
exists $chars[0] $chars[0] eq "<"
Truth table33%1/3
A and B
A= exists $chars[0]B= $chars[0] eq "<"
ABresult
0X0
100
111
177 3 shift @chars;
178 }
179 else {
180 0 ▶ $strictMode ? die 'unparsable string' : return ( undef, undef, ['unparsable string'] );
Branch: 1 branch
BranchTrueFalseTotal
$strictMode ? : 0 0 0
181 }
182  
183 58 CONTRIB:
184 $tmp = '';
185 58 ▶ while ( exists( $chars[0] ) and $chars[0] ne '>' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $chars[0] and $chars[0] ne ">") 278 58 336
Condition66%2/3
exists $chars[0] and $chars[0] ne ">"
!ll&&!rl&&r
058278
MC/DC50%1/2
exists $chars[0] and $chars[0] ne ">"
exists $chars[0] $chars[0] ne ">"
Truth table66%2/3
A and B
A= exists $chars[0]B= $chars[0] ne ">"
ABresult
0X0
100
111
186 278 $tmp .= shift @chars;
187 }
188 58 ▶ if ( $tmp and exists( $chars[0] ) and $chars[0] eq '>' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($tmp and exists $chars[0] and $chars[0] eq '>') { } 28 30 58
elsif (exists $chars[0] and $chars[0] eq '>') { } 30 0 30
Condition66%4/6
$tmp and exists $chars[0] and $chars[0] eq ">"
!ll&&!rl&&r
30028
$tmp and exists $chars[0]
!ll&&!rl&&r
30028
MC/DC33%1/3
$tmp and exists $chars[0] and $chars[0] eq ">"
$tmp exists $chars[0] $chars[0] eq ">"
Truth table50%2/4
A and B and C
A= $tmpB= exists $chars[0]C= $chars[0] eq ">"
ABCresult
0XX0
10X0
1100
1111
189  
190 # warn 'Contribution candidate: ' . $tmp;
191 28 ▶ if ( $tmp =~ /\A::(.+)\Z/ ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($tmp =~ /\A::(.+)\Z/) { } 2 26 28
elsif ($tmp =~ /\A:([^:]+)(?::(.+))?\Z/) { } 1 25 26
elsif ($tmp =~ /\A([^:]+):([^:]+)(?::(.+))?\Z/) { } 25 0 25
192 2 $self->contribution()->localNumber($1);
193 }
194 elsif ( $tmp =~ /\A:([^:]+)(?::(.+))?\Z/ ) {
195 1 $self->contribution()->titleCode($1);
196 1 ▶ $self->contribution()->localNumber($2) if $2;
Branch: 1 branch
BranchTrueFalseTotal
if $2 0 1 1
197 }
198 elsif ( $tmp =~ /\A([^:]+):([^:]+)(?::(.+))?\Z/ ) {
199 25 $self->contribution()->location($1);
200 25 $self->contribution()->titleCode($2);
201 25 ▶ $self->contribution()->localNumber($3) if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 2 23 25
202 }
203 else {
204 0 $self->contribution()->location($tmp);
205 }
206 28 shift @chars;
207 }
208 ▶ elsif ( exists( $chars[0] ) and $chars[0] eq '>' ) {
Condition33%1/3
exists $chars[0] and $chars[0] eq ">"
!ll&&!rl&&r
0030
MC/DC0%0/2
exists $chars[0] and $chars[0] eq ">"
exists $chars[0] $chars[0] eq ">"
Truth table33%1/3
A and B
A= exists $chars[0]B= $chars[0] eq ">"
ABresult
0X0
100
111
209 30 shift @chars;
210 }
211 else {
212 0 ▶ $strictMode ? die 'unparsable string' : return ( undef, undef, ['unparsable string'] );
Branch: 1 branch
BranchTrueFalseTotal
$strictMode ? : 0 0 0
213 }
214  
215 58 my $csi = '';
216 58 ▶ if ( exists( $chars[0] ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $chars[0]) 58 0 58
217 58 $csi = shift @chars;
218 }
219  
220 58 ▶ if ( exists( $chars[0] ) and $chars[0] eq '.' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $chars[0] and $chars[0] eq '.') { } 58 0 58
elsif (exists $chars[0]) { } 0 0 0
Condition33%1/3
exists $chars[0] and $chars[0] eq "."
!ll&&!rl&&r
0058
MC/DC0%0/2
exists $chars[0] and $chars[0] eq "."
exists $chars[0] $chars[0] eq "."
Truth table33%1/3
A and B
A= exists $chars[0]B= $chars[0] eq "."
ABresult
0X0
100
111
221 58 shift @chars;
222 }
223 elsif ( exists( $chars[0] ) ) {
224 0 ▶ shift(@chars) while ( $chars[0] ne '.' );
Branch: 1 branch
BranchTrueFalseTotal
$chars[0] ne "." and do { shift @chars } 0 0 0
225 }
226  
227 58 ▶ if ( exists( $chars[0] ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $chars[0]) 58 0 58
228 58 $self->control()->dpi( shift @chars );
229 }
230  
231 58 ▶ if ( exists( $chars[0] ) and $chars[0] eq '.' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $chars[0] and $chars[0] eq '.') { } 58 0 58
elsif (exists $chars[0]) { } 0 0 0
Condition33%1/3
exists $chars[0] and $chars[0] eq "."
!ll&&!rl&&r
0058
MC/DC0%0/2
exists $chars[0] and $chars[0] eq "."
exists $chars[0] $chars[0] eq "."
Truth table33%1/3
A and B
A= exists $chars[0]B= $chars[0] eq "."
ABresult
0X0
100
111
232 58 shift @chars;
233 }
234 elsif ( exists( $chars[0] ) ) {
235 0 ▶ shift(@chars) while ( $chars[0] ne '.' );
Branch: 1 branch
BranchTrueFalseTotal
$chars[0] ne "." and do { shift @chars } 0 0 0
236 }
237  
238 58 ▶ if ( exists( $chars[0] ) and exists( $chars[1] ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $chars[0] and exists $chars[1]) 58 0 58
Condition33%1/3
exists $chars[0] and exists $chars[1]
!ll&&!rl&&r
0058
MC/DC0%0/2
exists $chars[0] and exists $chars[1]
exists $chars[0] exists $chars[1]
Truth table33%1/3
A and B
A= exists $chars[0]B= exists $chars[1]
ABresult
0X0
100
111
239 58 $self->control()->mfi( join( '', splice( @chars, 0, 2 ) ) );
240 }
241  
242 58 my $isValid = $self->is_valid();
243 58 ▶ if ( $strictMode && !$isValid ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($strictMode and not $isValid) 0 58 58
Condition33%1/3
$strictMode and not $isValid
!ll&&!rl&&r
5800
MC/DC0%0/2
$strictMode and not $isValid
$strictMode not $isValid
Truth table33%1/3
A and not(B)
A= $strictModeB= not $isValid
ABresult
0X0
100
111
244 0 die 'parsing failed: invalid SICI';
245 }
246  
247 58 ▶ if ( $checkChar ne $self->checkchar() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($checkChar ne $self->checkchar) 0 58 58
248 0 push @{$parserProblems}, "wrong check char; was '$checkChar', should have been '$1'";
249 }
250 58 ▶ if ( $checkChar !~ /\A[0-9A-Z#]\Z/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($checkChar =~ /\A[0-9A-Z#]\Z/) 0 58 58
251 0 push @{$parserProblems}, 'invalid original check char';
252 }
253  
254 58 ▶ if ( $self->control()->csi() ne $csi ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->control->csi ne $csi) 0 58 58
255 0 push @{$parserProblems}, 'wrong csi in string input';
256 }
257  
258 58 ▶ my $roundTrip = ( $self->parsedString() eq $self->to_string() ? 1 : 0 );
Branch: 1 branch
BranchTrueFalseTotal
$self->parsedString eq $self->to_string ? : 58 0 58
259 58 return ( $isValid, $roundTrip, $parserProblems );
260 } ## end sub parse
261  
262  
263 121 ▶sub to_string {
Subroutine to_string: called CC=1 SCAR=0.0
Pod documented
264 121 my $self = shift;
265  
266 121 my $str = $self->_to_string();
267 121 my $cs = calculate_check_char($str);
268  
269 121 return $str . $cs;
270 }
271  
272 179 ▶sub _to_string {
Subroutine _to_string: called CC=1 SCAR=0.0
273 179 my $self = shift;
274  
275 179 my $item = $self->item()->to_string();
276 179 my $contrib = $self->contribution()->to_string();
277 179 my $control = $self->control()->to_string();
278  
279 179 return sprintf( '%s<%s>%s-', $item, $contrib, $control );
280 }
281  
282  
283 58 ▶sub checkchar {
Subroutine checkchar: called CC=1 SCAR=0.0
Pod documented
284 58 my $self = shift;
285  
286 58 my $siciAsString = $self->_to_string();
287  
288 58 return calculate_check_char($siciAsString);
289 }
290  
291  
292 58 ▶sub reset {
Subroutine reset: called CC=1 SCAR=0.0
Pod documented
293 58 my $self = shift;
294 58 $self->item()->reset();
295 58 $self->contribution()->reset();
296 58 $self->control()->reset();
297 58 return;
298 }
299  
300  
301 58 ▶sub is_valid {
Subroutine is_valid: called CC=4 SCAR=16.1
Pod documented
302 58 my $self = shift;
303  
304 58 my $itemIsValid = $self->item()->is_valid();
305 58 my $contribIsValid = $self->contribution()->is_valid();
306 58 my $controlIsValid = $self->control()->is_valid();
307  
308 58 ▶ if ( $itemIsValid && $contribIsValid && $controlIsValid ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($itemIsValid and $contribIsValid and $controlIsValid) 58 0 58
Condition33%2/6
$itemIsValid and $contribIsValid and $controlIsValid
!ll&&!rl&&r
0058
$itemIsValid and $contribIsValid
!ll&&!rl&&r
0058
MC/DC0%0/3
$itemIsValid and $contribIsValid and $controlIsValid
$itemIsValid $contribIsValid $controlIsValid
Truth table25%1/4
A and B and C
A= $itemIsValidB= $contribIsValidC= $controlIsValid
ABCresult
0XX0
10X0
1100
1111
309 58 return 1;
310 }
311  
312 0 return 0;
313 }
314  
315  
316 63 ▶sub list_problems {
Subroutine list_problems: called CC=5 SCAR=20.5
Pod documented
317 63 my $self = shift;
318  
319 63 my $hasProblems = 0;
320 63 my %problems = ();
321 63 ▶ if ( not $self->item()->is_valid() ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->item->is_valid) 0 63 63
322 0 $hasProblems++;
323 0 $problems{'item'} = { $self->item()->list_problems() };
324 }
325 63 ▶ if ( not $self->contribution()->is_valid() ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->contribution->is_valid) 0 63 63
326 0 $hasProblems++;
327 0 $problems{'contribution'} = { $self->contribution()->list_problems() };
328 }
329 63 ▶ if ( not $self->control()->is_valid() ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->control->is_valid) 0 63 63
330 0 $hasProblems++;
331 0 $problems{'control'} = { $self->control()->list_problems() };
332 }
333  
334 63 ▶ if ($hasProblems) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hasProblems) 0 63 63
335 0 return %problems;
336 }
337 63 return;
338 }
339  
340 3 1;
341  
342 __END__
↑ Summary SICI/ItemSegment.pm »