line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::Elemental::Node; |
2
|
3
|
|
|
3
|
|
1997
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
889
|
|
3
|
|
|
|
|
|
|
|
4
|
30
|
|
|
30
|
0
|
834
|
sub new { bless {}, $_[0]; } |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub root { |
7
|
12
|
|
|
12
|
0
|
2609
|
my $e = shift; |
8
|
12
|
|
|
|
|
36
|
while ($e->{parent}) { $e = $e->{parent} } |
|
26
|
|
|
|
|
52
|
|
9
|
12
|
|
|
|
|
67
|
return $e; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub ancestors { |
13
|
1
|
|
|
1
|
0
|
3
|
my $e = shift; |
14
|
1
|
|
|
|
|
2
|
my @a; |
15
|
1
|
|
|
|
|
5
|
while ($e->{parent}) { |
16
|
2
|
|
|
|
|
5
|
$e = $e->{parent}; |
17
|
2
|
|
|
|
|
6
|
push @a, $e; |
18
|
|
|
|
|
|
|
} |
19
|
1
|
|
|
|
|
6
|
return @a; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub in_element { |
23
|
4
|
|
|
4
|
0
|
19
|
my ($e, $a) = @_; |
24
|
4
|
|
|
|
|
15
|
while ($e->{parent}) { |
25
|
6
|
|
|
|
|
8
|
$e = $e->{parent}; |
26
|
6
|
100
|
|
|
|
31
|
return 1 if $e == $a; |
27
|
|
|
|
|
|
|
} |
28
|
1
|
|
|
|
|
4
|
return 0; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub DESTROY { |
32
|
82
|
|
|
82
|
|
2418
|
my $self = shift; |
33
|
82
|
100
|
|
|
|
187
|
if ($self->{contents}) { |
34
|
17
|
|
|
|
|
24
|
for (@{$self->{contents}}) { |
|
17
|
|
|
|
|
42
|
|
35
|
36
|
50
|
33
|
|
|
264
|
$_->DESTROY if $_ && $_->isa('XML::Elemental::Node'); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
82
|
|
|
|
|
721
|
%$self = (); # safety first. |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |