Elemental/Node.pm

filter: Statementstmt 100% 26 / 26 Branchbran 91.6% 11 / 12 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 4 totaltotal 83.0% 44 / 53 CC 9 SCAR 11.8
CC
9
Cov
93%
DESTROY
5.3
in_element
3.0
root
2.0
CRAP 3.3
« Parser/Style/Elemental.pm ↑ Summary Elemental/Util.pm »
1 package XML::Elemental::Node;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 30 ▶sub new { bless {}, $_[0]; }
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
5  
6 12 ▶sub root {
Subroutine root: called CC=2 SCAR=6.9
Pod undocumented
7 12 my $e = shift;
8 12 ▶ while ($e->{parent}) { $e = $e->{parent} }
Branch: 1 branch
BranchTrueFalseTotal
if ($e->{"parent"}) 26 12 38
9 12 return $e;
10 }
11  
12 1 ▶sub ancestors {
Subroutine ancestors: called CC=2 SCAR=6.9
Pod undocumented
13 1 my $e = shift;
14 1 my @a;
15 1 ▶ while ($e->{parent}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e->{"parent"}) 2 1 3
16 2 $e = $e->{parent};
17 2 push @a, $e;
18 }
19 1 return @a;
20 }
21  
22 4 ▶sub in_element {
Subroutine in_element: called CC=3 SCAR=11.0
Pod undocumented
23 4 my ($e, $a) = @_;
24 4 ▶ while ($e->{parent}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e->{"parent"}) 6 1 7
25 6 $e = $e->{parent};
26 6 ▶ return 1 if $e == $a;
Branch: 1 branch
BranchTrueFalseTotal
if $e == $a 3 3 6
27 }
28 1 return 0;
29 }
30  
31 82 ▶sub DESTROY {
Subroutine DESTROY: called CC=5 SCAR=16.7
32 82 my $self = shift;
33 82 ▶ if ($self->{contents}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"contents"}) 17 65 82
34 17 for (@{$self->{contents}}) {
35 36 ▶ $_->DESTROY if $_ && $_->isa('XML::Elemental::Node');
Branch: 1 branch
BranchTrueFalseTotal
if $_ and $_->isa("XML::Elemental::Node") 36 0 36
Condition33%1/3
$_ and $_->isa("XML::Elemental::Node")
!ll&&!rl&&r
0036
MC/DC0%0/2
$_ and $_->isa("XML::Elemental::Node")
$_ $_->isa("XML::Elemental::Node")
Truth table33%1/3
A and B
A= $_B= $_->isa("XML::Elemental::Node")
ABresult
0X0
100
111
36 }
37 }
38 82 %$self = (); # safety first.
39 }
40  
41 3 1;
42  
43 __END__
« Parser/Style/Elemental.pm ↑ Summary Elemental/Util.pm »