YADV/Structure/Array.pm

filter: Statementstmt 100% 22 / 22 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 91.6% 33 / 36 CC 4 SCAR 6.4
CC
4
Cov
96%
_get_child_node
3.0
each
2.0
BEGIN
1.0
CRAP 1.9
« YADV/Structure/Hash.pm ↑ Summary YADV/Structure.pm »
1 package Data::YADV::Structure::Array;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use base 'Data::YADV::Structure::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 18 ▶sub _get_child_node {
Subroutine _get_child_node: called CC=3 SCAR=11.0
9 18 my ($self, $entry) = @_;
10  
11 18 ▶ $self->die(qq(Wrong array index), $entry) unless $entry =~ /^\[(.+)\]$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $entry =~ /^\[(.+)\]$/ 0 18 18
12 18 my $index = $1;
13  
14 18 my $structure = $self->get_structure;
15 18 ▶ return undef unless abs($index) < scalar @$structure;
Branch: 1 branch
BranchTrueFalseTotal
unless abs $index < scalar @$structure 1 17 18
16  
17 17 $self->_build_node($entry, $structure->[$index]);
18 };
19  
20 2 ▶sub get_size { scalar @{$_[0]->get_structure} }
Subroutine get_size: called CC=1 SCAR=0.0
Pod undocumented
21  
22 1 ▶sub each {
Subroutine each: called CC=2 SCAR=6.9
Pod undocumented
23 1 my ($self, $cb) = @_;
24  
25 1 my $size = $self->get_size;
26 1 ▶ for (my $i = 0; $i < $size; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $size) 2 1 3
27 2 $cb->($self->get_child("[$i]"), $i);
28 }
29 }
30  
31 1 1;
« YADV/Structure/Hash.pm ↑ Summary YADV/Structure.pm »