| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 25 | 6 | $e = $e->{parent}; | |||||||||||||||||||||||||||
| 26 | 6 | ▶ | return 1 if $e == $a; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 34 | 17 | for (@{$self->{contents}}) { | |||||||||||||||||||||||||||
| 35 | 36 | ▶ | $_->DESTROY if $_ && $_->isa('XML::Elemental::Node'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_ and $_->isa("XML::Elemental::Node")
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")
| |||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | 82 | %$self = (); # safety first. | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 3 | 1; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | __END__ | ||||||||||||||||||||||||||||