blib/lib/Convert/Binary/C/Cached.pm

filter: Statementstmt 88.0% 176 / 200 Branchbran 76.0% 105 / 138 Conditioncond 72.2% 26 / 36 MC/DCmcdc 52.3% 11 / 21 Subroutinesub 94.7% 18 / 19 Podpod 100% 7 / 7 totaltotal 81.4% 343 / 421 CC 89 SCAR 30.9
CC
89
Cov
82%
__can_use_cache
51.2
configure
21.2
__reccmp
16.0
CRAP 22.0
« support/Test/More.pm ↑ Summary support/Test/Harness/Straps.pm »
1 ################################################################################
2 #
3 # MODULE: Convert::Binary::C::Cached
4 #
5 ################################################################################
6 #
7 # DESCRIPTION: Cached version of Convert::Binary::C module
8 #
9 ################################################################################
10 #
11 # Copyright (c) 2002-2020 Marcus Holland-Moritz. All rights reserved.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the same terms as Perl itself.
14 #
15 ################################################################################
16  
17 package Convert::Binary::C::Cached;
18  
19 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 5 ▶use Convert::Binary::C;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 5 ▶use vars qw( @ISA $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 5 @ISA = qw(Convert::Binary::C);
25  
26 5 $VERSION = '0.84';
27  
28 sub new
29 {
30 938 ▶ my $class = shift;
Subroutine new: called CC=3 SCAR=11.0
Pod documented
31 938 my $self = $class->SUPER::new;
32  
33 938 $self->{cache} = undef;
34 938 $self->{parsed} = 0;
35 938 $self->{uses_cache} = 0;
36  
37 938 ▶ @_ % 2 and croak "Number of configuration arguments to new must be even";
Branch: 1 branch
BranchTrueFalseTotal
@_ % 2 and croak("Number of configuration arguments to new must be even") 1 937 938
38  
39 937 ▶ @_ and $self->configure(@_);
Branch: 1 branch
BranchTrueFalseTotal
@_ and $self->configure(@_) 935 2 937
40  
41 934 return $self;
42 }
43  
44 sub configure
45 {
46 1973 ▶ my $self = shift;
Subroutine configure: called CC=20 SCAR=30.5
Pod documented
47  
48 1973 ▶ if (@_ < 2 and not defined wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ < 2 and not defined wantarray) 3 1970 1973
Condition100%3/3
@_ < 2 and not defined wantarray
!ll&&!rl&&r
10109603
MC/DC100%2/2
@_ < 2 and not defined wantarray
@_ < 2 not defined wantarray
Truth table100%3/3
A and not(B)
A= @_ < 2B= not defined wantarray
ABresult
0X0
100
111
49 3 ▶ $^W and carp "Useless use of configure in void context";
Branch: 1 branch
BranchTrueFalseTotal
$^W and carp("Useless use of configure in void context") 2 1 3
50 3 return;
51 }
52  
53 1970 ▶ if (@_ == 0) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_ == 0) { } 960 1010 1970
elsif (@_ == 1 and $_[0] eq 'Cache') { } 0 2020 2020
54 960 my $cfg = $self->SUPER::configure;
55 960 $cfg->{Cache} = $self->{cache};
56 960 return $cfg;
57 }
58 ▶ elsif (@_ == 1 and $_[0] eq 'Cache') {
Condition33%1/3
@_ == 1 and $_[0] eq "Cache"
!ll&&!rl&&r
101000
MC/DC0%0/2
@_ == 1 and $_[0] eq "Cache"
@_ == 1 $_[0] eq "Cache"
Truth table33%1/3
A and B
A= @_ == 1B= $_[0] eq "Cache"
ABresult
0X0
100
111
59 0 return $self->{cache};
60 }
61  
62 1010 my @args;
63  
64 1010 ▶ if (@_ == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_ == 1) { } 0 1010 1010
elsif (@_ % 2 == 0) { } 1010 0 1010
65 0 @args = @_;
66 }
67 elsif (@_ % 2 == 0) {
68 1010 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1373 1009 2382
69 1373 my %arg = splice @_, 0, 2;
70 1373 ▶ if (exists $arg{Cache}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $arg{'Cache'}) { } 930 443 1373
71 930 ▶ if ($self->{parsed}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'parsed'}) { } 0 930 930
elsif (ref $arg{'Cache'}) { } 1 929 930
72 0 croak 'Cache cannot be configured after parsing';
73 }
74 elsif (ref $arg{Cache}) {
75 1 croak 'Cache must be a string value, not a reference';
76 }
77 else {
78 929 ▶ if (defined $arg{Cache}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $arg{"Cache"}) 929 0 929
79 929 my @missing;
80 929 eval { require Data::Dumper };
81 929 ▶ $@ and push @missing, 'Data::Dumper';
Branch: 1 branch
BranchTrueFalseTotal
$@ and push @missing, "Data::Dumper" 2 927 929
82 929 eval { require IO::File };
83 929 ▶ $@ and push @missing, 'IO::File';
Branch: 1 branch
BranchTrueFalseTotal
$@ and push @missing, "IO::File" 1 928 929
84 929 ▶ if (@missing) {
Branch: 1 branch
BranchTrueFalseTotal
if (@missing) 2 927 929
85 2 ▶ $^W and carp "Cannot load ", join(' and ', @missing), ", disabling cache";
Branch: 1 branch
BranchTrueFalseTotal
$^W and carp("Cannot load ", join(" and ", @missing), ", disabling cache") 2 0 2
86 2 undef $arg{Cache};
87 }
88 }
89 929 $self->{cache} = $arg{Cache};
90 }
91 }
92 443 else { push @args, %arg }
93 }
94 }
95  
96 1009 my $opt = $self;
97  
98 1009 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 117 892 1009
99 117 $opt = eval { $self->SUPER::configure(@args) };
100 117 ▶ $@ =~ s/\s+at.*?Cached\.pm.*//s, croak $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 44 73 117
101 }
102  
103 965 $opt;
104 }
105  
106 sub clean
107 {
108 46 ▶ my $self = shift;
Subroutine clean: called CC=2 SCAR=6.9
Pod documented
109  
110 46 delete $self->{$_} for grep !/^(?:|cache|parsed|uses_cache)$/, keys %$self;
111  
112 46 $self->{parsed} = 0;
113 46 $self->{uses_cache} = 0;
114  
115 46 $self->SUPER::clean;
116 }
117  
118 sub clone
119 {
120 3 ▶ my $self = shift;
Subroutine clone: called CC=6 SCAR=26.5
Pod documented
121  
122 3 ▶ unless (defined wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined wantarray) 3 0 3
123 3 ▶ $^W and carp "Useless use of clone in void context";
Branch: 1 branch
BranchTrueFalseTotal
$^W and carp("Useless use of clone in void context") 2 1 3
124 3 return;
125 }
126  
127 0 my $clone = $self->SUPER::clone;
128  
129 0 for (keys %$self) {
130 0 ▶ if ($_) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_) 0 0 0
131 0 ▶ $clone->{$_} = ref $_ eq 'ARRAY' ? [@{$self->{$_}}] : $self->{$_};
Branch: 1 branch
BranchTrueFalseTotal
ref $_ eq 'ARRAY' ? : 0 0 0
132 }
133 }
134  
135 0 $clone;
136 }
137  
138 sub parse_file
139 {
140 47 ▶ my $self = shift;
Subroutine parse_file: called CC=4 SCAR=13.9
Pod documented
141 47 my($warn,$error) = $self->__parse('file', $_[0]);
142 46 for my $w ( @$warn ) { carp $w }
143 46 ▶ defined $error and croak $error;
Branch: 1 branch
BranchTrueFalseTotal
defined $error and croak($error) 6 40 46
144 40 ▶ defined wantarray and return $self;
Branch: 1 branch
BranchTrueFalseTotal
defined wantarray and return $self 12 28 40
145 }
146  
147 sub parse
148 {
149 976 ▶ my $self = shift;
Subroutine parse: called CC=4 SCAR=13.9
Pod documented
150 976 my($warn,$error) = $self->__parse('code', $_[0]);
151 975 for my $w ( @$warn ) { carp $w }
152 975 ▶ defined $error and croak $error;
Branch: 1 branch
BranchTrueFalseTotal
defined $error and croak($error) 57 918 975
153 918 ▶ defined wantarray and return $self;
Branch: 1 branch
BranchTrueFalseTotal
defined wantarray and return $self 15 903 918
154 }
155  
156 sub dependencies
157 {
158 20 ▶ my $self = shift;
Subroutine dependencies: called CC=5 SCAR=16.1
Pod documented
159  
160 20 ▶ $self->{parsed} or croak "Call to dependencies without parse data";
Branch: 1 branch
BranchTrueFalseTotal
$self->{"parsed"} or croak("Call to dependencies without parse data") 3 17 20
161  
162 17 ▶ unless (defined wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined wantarray) 3 14 17
163 3 ▶ $^W and carp "Useless use of dependencies in void context";
Branch: 1 branch
BranchTrueFalseTotal
$^W and carp("Useless use of dependencies in void context") 2 1 3
164 3 return;
165 }
166  
167 14 ▶ $self->{files} || $self->SUPER::dependencies;
Branch: 1 branch
BranchTrueFalseTotal
$self->{"files"} or $self->SUPER::dependencies 7 7 14
168 }
169  
170 sub __uses_cache
171 {
172 904 ▶ my $self = shift;
Subroutine __uses_cache: called CC=1 SCAR=0.0
173 904 $self->{uses_cache};
174 }
175  
176 sub __parse
177 {
178 1023 ▶ my $self = shift;
Subroutine __parse: called CC=10 SCAR=23.0
179  
180 1023 ▶ if (defined $self->{cache}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"cache"}) 927 96 1023
181 927 ▶ $self->{parsed} and croak "Cannot parse more than once for cached objects";
Branch: 1 branch
BranchTrueFalseTotal
$self->{"parsed"} and croak("Cannot parse more than once for cached objects") 1 926 927
182  
183 926 $self->{$_[0]} = $_[1];
184  
185 926 ▶ if ($self->__can_use_cache) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->__can_use_cache) 43 883 926
186 43 my @WARN;
187 {
188 43 ▶ local $SIG{__WARN__} = sub { push @WARN, $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=0.4
189 43 eval { $self->SUPER::parse_file($self->{cache}) };
190 }
191 43 ▶ unless ($@ or @WARN) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($@ or @WARN) 26 17 43
Condition66%2/3
$@ or @WARN
l!l&&r!l&&!r
17026
MC/DC50%1/2
$@ or @WARN
$@ @WARN
Truth table66%2/3
A or B
A= $@B= @WARN
ABresult
1X1
011
000
192 26 $self->{parsed} = 1;
193 26 $self->{uses_cache} = 1;
194 26 return;
195 }
196 17 $self->clean;
197 }
198 }
199  
200 996 $self->{parsed} = 1;
201  
202 996 my(@warnings, $error);
203 {
204 996 ▶ local $SIG{__WARN__} = sub { push @warnings, $_[0] };
Subroutine __ANON__: called CC=1 SCAR=0.0
205  
206 996 ▶ if ($_[0] eq 'file') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0] eq 'file') { } 23 973 996
207 23 eval { $self->SUPER::parse_file($_[1]) };
208 }
209 else {
210 973 eval { $self->SUPER::parse($_[1]) };
211 }
212 }
213  
214 996 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 63 933 996
215 63 $error = $@;
216 63 $error =~ s/\s+at.*?Cached\.pm.*//s;
217 }
218 else {
219 933 ▶ defined $self->{cache} and $self->__save_cache;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{"cache"} and $self->__save_cache 900 33 933
220 }
221  
222 995 for (@warnings) { s/\s+at.*?Cached\.pm.*//s }
223  
224 995 (\@warnings, $error);
225 }
226  
227 sub __can_use_cache
228 {
229 926 ▶ my $self = shift;
Subroutine __can_use_cache: called CC=28 SCAR=39.3
230 926 my $fh = IO::File->new;
231  
232 926 ▶ unless (-e $self->{cache} and -s _) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $self->{"cache"} and -s _) 5 921 926
Condition66%2/3
-e $self->{"cache"} and -s _
!ll&&!rl&&r
50921
MC/DC50%1/2
-e $self->{"cache"} and -s _
-e $self->{"cache"} -s _
Truth table66%2/3
A and B
A= -e $self->{"cache"}B= -s _
ABresult
0X0
100
111
233 5 ▶ $ENV{CBCC_DEBUG} and print STDERR "CBCC: cache file '$self->{cache}' doesn't exist or is empty\n";
Branch: 1 branch
BranchTrueFalseTotal
$ENV{"CBCC_DEBUG"} and print STDERR qq[CBCC: cache file '$self->{"cache"}' doesn't exist or is empty\n] 0 5 5
234 5 return 0;
235 }
236  
237 921 ▶ unless ($fh->open($self->{cache})) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($fh->open($self->{"cache"})) 0 921 921
238 0 ▶ $^W and carp "Cannot open '$self->{cache}': $!";
Branch: 1 branch
BranchTrueFalseTotal
$^W and carp(qq[Cannot open '$self->{"cache"}': $!]) 0 0 0
239 0 ▶ $ENV{CBCC_DEBUG} and print STDERR "CBCC: cannot open cache file '$self->{cache}'\n";
Branch: 1 branch
BranchTrueFalseTotal
$ENV{"CBCC_DEBUG"} and print STDERR qq[CBCC: cannot open cache file '$self->{"cache"}'\n] 0 0 0
240 0 return 0;
241 }
242  
243 921 my @warnings;
244 921 my @config = do {
245 921 my $config;
246 921 ▶ unless (defined($config = <$fh>)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined($config = readline $fh)) 0 921 921
247 0 ▶ $ENV{CBCC_DEBUG} and print STDERR "CBCC: cannot read configuration\n";
Branch: 1 branch
BranchTrueFalseTotal
$ENV{"CBCC_DEBUG"} and print STDERR "CBCC: cannot read configuration\n" 0 0 0
248 0 return 0;
249 }
250 921 ▶ unless ($config =~ /^#if\s+0/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($config =~ /^#if\s+0/) 5 916 921
251 5 ▶ $ENV{CBCC_DEBUG} and print STDERR "CBCC: invalid configuration\n";
Branch: 1 branch
BranchTrueFalseTotal
$ENV{"CBCC_DEBUG"} and print STDERR "CBCC: invalid configuration\n" 0 5 5
252 5 return 0;
253 }
254 916 local $/ = $/.'#endif';
255 916 chomp($config = <$fh>);
256 916 $config =~ s/^\*//gms;
257 916 ▶ local $SIG{__WARN__} = sub { push @warnings, $_[0] };
Subroutine __ANON__: called CC=1 SCAR=0.0
258 916 eval $config;
259 };
260  
261 # corrupt config
262 916 ▶ if ($@ or @warnings or @config % 2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@ or @warnings or @config % 2) 0 49 49
Condition66%4/6
$@ or @warnings or @config % 2
l!l&&r!l&&!r
867049
$@ or @warnings
l!l&&r!l&&!r
867049
MC/DC33%1/3
$@ or @warnings or @config % 2
$@ @warnings @config % 2
Truth table50%2/4
A or B or C
A= $@B= @warningsC= @config % 2
ABCresult
1XX1
01X1
0011
0000
263 867 ▶ $ENV{CBCC_DEBUG} and print STDERR "CBCC: broken configuration\n";
Branch: 1 branch
BranchTrueFalseTotal
$ENV{"CBCC_DEBUG"} and print STDERR "CBCC: broken configuration\n" 0 867 867
264 867 return 0;
265 }
266  
267 49 my %config = @config;
268  
269 49 ▶ my $what = exists $self->{code} ? 'code' : 'file';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'code'} ? : 23 26 49
270  
271 49 ▶ unless (exists $config{$what} and
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $config{$what} and $config{$what} eq $self->{$what} and __reccmp($config{"cfg"}, $self->configure)) 2 46 48
Condition100%6/6
exists $config{$what} and $config{$what} eq $self->{$what} and __reccmp($config{"cfg"}, $self->configure)
!ll&&!rl&&r
2146
exists $config{$what} and $config{$what} eq $self->{$what}
!ll&&!rl&&r
1147
MC/DC100%3/3
exists $config{$what} and $config{$what} eq $self->{$what} and __reccmp($config{"cfg"}, $self->configure)
exists $config{$what} $config{$what} eq $self->{$what} __reccmp($config{"cfg"}, $self->configure)
Truth table100%4/4
A and B and C
A= exists $config{$what}B= $config{$what} eq $self->{$what}C= __reccmp($config{"cfg"}, $self->configure)
ABCresult
0XX0
10X0
1100
1111
272 $config{$what} eq $self->{$what} and
273 __reccmp($config{cfg}, $self->configure)) {
274 3 ▶ if ($ENV{CBCC_DEBUG}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"CBCC_DEBUG"}) 0 3 3
275 0 print STDERR "CBCC: configuration has changed\n";
276 0 print STDERR "CBCC: what='$what', \$config{$what}='$config{$what}' \$self->{$what}='$self->{$what}'\n";
277 0 my $dump = Data::Dumper->Dump([$config{cfg}, $self->configure], ['config', 'self']);
278 0 $dump =~ s/^/CBCC: /mg;
279 0 print STDERR $dump;
280 }
281 3 return 0;
282 }
283  
284 46 ▶ while (my($file, $spec) = each %{$config{files}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$config{"files"};}) 936 43 979
285 936 ▶ unless (-e $file) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $file) 0 936 936
286 0 ▶ $ENV{CBCC_DEBUG} and print STDERR "CBCC: file '$file' deleted\n";
Branch: 1 branch
BranchTrueFalseTotal
$ENV{"CBCC_DEBUG"} and print STDERR "CBCC: file '${file}' deleted\n" 0 0 0
287 0 return 0;
288 }
289 936 my($size, $mtime, $ctime) = (stat(_))[7,9,10];
290 936 ▶ unless ($spec->{size} == $size and
Branch: 1 branch
BranchTrueFalseTotal
unless ($spec->{"size"} == $size and $spec->{"mtime"} == $mtime and $spec->{"ctime"} == $ctime) 1 933 934
Condition83%5/6
$spec->{"size"} == $size and $spec->{"mtime"} == $mtime and $spec->{"ctime"} == $ctime
!ll&&!rl&&r
30933
$spec->{"size"} == $size and $spec->{"mtime"} == $mtime
!ll&&!rl&&r
21933
MC/DC66%2/3
$spec->{"size"} == $size and $spec->{"mtime"} == $mtime and $spec->{"ctime"} == $ctime
$spec->{"size"} == $size $spec->{"mtime"} == $mtime $spec->{"ctime"} == $ctime
Truth table75%3/4
A and B and C
A= $spec->{"size"} == $sizeB= $spec->{"mtime"} == $mtimeC= $spec->{"ctime"} == $ctime
ABCresult
0XX0
10X0
1100
1111
291 $spec->{mtime} == $mtime and
292 $spec->{ctime} == $ctime) {
293 3 ▶ $ENV{CBCC_DEBUG} and print STDERR "CBCC: size/mtime/ctime of '$file' changed\n";
Branch: 1 branch
BranchTrueFalseTotal
$ENV{"CBCC_DEBUG"} and print STDERR "CBCC: size/mtime/ctime of '${file}' changed\n" 0 3 3
294 3 return 0;
295 }
296 }
297  
298 43 $self->{files} = $config{files};
299  
300 43 ▶ $ENV{CBCC_DEBUG} and print STDERR "CBCC: '$self->{cache}' is usable\n";
Branch: 1 branch
BranchTrueFalseTotal
$ENV{"CBCC_DEBUG"} and print STDERR qq[CBCC: '$self->{"cache"}' is usable\n] 0 43 43
301 43 return 1;
302 }
303  
304 sub __save_cache
305 {
306 900 ▶ my $self = shift;
Subroutine __save_cache: called CC=3 SCAR=11.0
307 900 my $fh = IO::File->new;
308  
309 900 ▶ $fh->open(">$self->{cache}") or croak "Cannot open '$self->{cache}': $!";
Branch: 1 branch
BranchTrueFalseTotal
$fh->open(qq[>$self->{"cache"}]) or croak(qq[Cannot open '$self->{"cache"}': $!]) 1 899 900
310  
311 899 ▶ my $what = exists $self->{code} ? 'code' : 'file';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'code'} ? : 877 22 899
312  
313 899 my $config = Data::Dumper->new([{ $what => $self->{$what},
314 cfg => $self->configure,
315 files => scalar $self->SUPER::dependencies,
316 }], ['*'])->Indent(1)->Dump;
317 899 $config =~ s/[^(]*//;
318 899 $config =~ s/^/*/gms;
319  
320 print $fh "#if 0\n", $config, "#endif\n\n",
321 899 do { local $^W; $self->sourcify({ Context => 1 }) };
322 }
323  
324 sub __reccmp
325 {
326 3499 ▶ my($ref, $val) = @_;
Subroutine __reccmp: called CC=14 SCAR=27.7
327  
328 3499 ▶ !defined($ref) && !defined($val) and return 1;
Branch: 1 branch
BranchTrueFalseTotal
defined $ref or defined $val or return 1 10 3489 3499
Condition66%2/3
defined $ref or defined $val
l!l&&r!l&&!r
3489010
MC/DC50%1/2
defined $ref or defined $val
defined $ref defined $val
Truth table66%2/3
A or B
A= defined $refB= defined $val
ABresult
1X1
011
000
329 3489 ▶ !defined($ref) || !defined($val) and return 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $ref and defined $val or return 0 0 3489 3489
Condition33%1/3
defined $ref and defined $val
!ll&&!rl&&r
003489
MC/DC0%0/2
defined $ref and defined $val
defined $ref defined $val
Truth table33%1/3
A and B
A= defined $refB= defined $val
ABresult
0X0
100
111
330  
331 3489 ▶ ref $ref or return $ref eq $val;
Branch: 1 branch
BranchTrueFalseTotal
ref $ref or return $ref eq $val 3164 325 3489
332  
333 325 ▶ if (ref $ref eq 'ARRAY') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $ref eq 'ARRAY') { } 186 139 325
elsif (ref $ref eq 'HASH') { } 139 0 139
334 186 ▶ @$ref == @$val or return 0;
Branch: 1 branch
BranchTrueFalseTotal
@$ref == @$val or return 0 1 185 186
335 185 for (0..$#$ref) {
336 2044 ▶ __reccmp($ref->[$_], $val->[$_]) or return 0;
Branch: 1 branch
BranchTrueFalseTotal
__reccmp($ref->[$_], $val->[$_]) or return 0 0 2044 2044
337 }
338 }
339 elsif (ref $ref eq 'HASH') {
340 139 ▶ keys %$ref == keys %$val or return 0;
Branch: 1 branch
BranchTrueFalseTotal
keys %$ref == keys %$val or return 0 0 139 139
341 139 for (keys %$ref) {
342 1408 ▶ __reccmp($ref->{$_}, $val->{$_}) or return 0;
Branch: 1 branch
BranchTrueFalseTotal
__reccmp($ref->{$_}, $val->{$_}) or return 0 1 1407 1408
343 }
344 }
345 0 else { return 0 }
346  
347 323 return 1;
348 }
349  
350 5 1;
351  
352 __END__
« support/Test/More.pm ↑ Summary support/Test/Harness/Straps.pm »