line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::XMetaL::Mock::DOMNodeList;
|
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
42143
|
use 5.008;
|
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
182
|
|
4
|
4
|
|
|
4
|
|
24
|
use strict;
|
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
158
|
|
5
|
4
|
|
|
4
|
|
22
|
use warnings;
|
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
132
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
23
|
use Carp;
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
388
|
|
8
|
4
|
|
|
4
|
|
1293
|
use Hash::Util qw(lock_keys);
|
|
4
|
|
|
|
|
3869
|
|
|
4
|
|
|
|
|
27
|
|
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
351
|
use constant TRUE => 1;
|
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
444
|
|
11
|
4
|
|
|
4
|
|
22
|
use constant FALSE => 0;
|
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
2378
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new {
|
14
|
6
|
|
|
6
|
0
|
12
|
my ($class, @items) = @_;
|
15
|
6
|
|
|
|
|
10
|
my $self;
|
16
|
6
|
|
|
|
|
8
|
eval {
|
17
|
|
|
|
|
|
|
#lock_keys(%args,qw());
|
18
|
6
|
|
33
|
|
|
50
|
$self = bless {
|
19
|
|
|
|
|
|
|
length => undef,
|
20
|
|
|
|
|
|
|
_node_list => [],
|
21
|
|
|
|
|
|
|
}, ref($class) || $class;
|
22
|
6
|
|
|
|
|
56
|
lock_keys(%$self, keys %$self);
|
23
|
6
|
50
|
|
|
|
260
|
$self->add(@items) if @items;
|
24
|
|
|
|
|
|
|
};
|
25
|
6
|
50
|
|
|
|
20
|
croak $@ if $@;
|
26
|
6
|
|
|
|
|
45
|
return $self;
|
27
|
|
|
|
|
|
|
}
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub add {
|
30
|
3
|
|
|
3
|
0
|
6
|
my ($self, @items) = @_;
|
31
|
3
|
|
|
|
|
6
|
my $node_list = $self->{_node_list};
|
32
|
|
|
|
|
|
|
#push @$node_list, grep {eval{$_->isa('XML::XMetaL::Mock::DOMNode')}} @items;
|
33
|
3
|
|
|
|
|
3
|
my $last_node_in_list;
|
34
|
3
|
|
|
|
|
6
|
foreach my $item (@items) {
|
35
|
3
|
100
|
|
|
|
8
|
if (scalar(@$node_list)) {
|
36
|
1
|
|
|
|
|
2
|
$last_node_in_list = $$node_list[-1];
|
37
|
1
|
|
|
|
|
5
|
$self->_link_to_next($last_node_in_list, $item);
|
38
|
|
|
|
|
|
|
#$self->_link_to_previous($last_node_in_list, $item);
|
39
|
|
|
|
|
|
|
}
|
40
|
3
|
|
|
|
|
9
|
push @$node_list, $item;
|
41
|
|
|
|
|
|
|
}
|
42
|
3
|
|
|
|
|
12
|
$self->{length} = scalar @$node_list;
|
43
|
|
|
|
|
|
|
}
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _link_to_next {
|
46
|
1
|
|
|
1
|
|
3
|
my ($self, $previous_node, $next_node) = @_;
|
47
|
1
|
|
|
|
|
5
|
$previous_node->{nextSibling} = $next_node;
|
48
|
|
|
|
|
|
|
}
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub item {
|
51
|
0
|
|
|
0
|
0
|
|
my ($self, $index) = @_;
|
52
|
0
|
|
|
|
|
|
my $node_list = $self->{_node_list};
|
53
|
0
|
|
|
|
|
|
return $$node_list[$index];
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
#cloneNode
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub hasChildNodes {
|
59
|
0
|
|
|
0
|
0
|
|
my $self = shift @_;
|
60
|
0
|
|
|
|
|
|
my XML::XMetaL::Mock::DOMNodeList $child_node_list = $self->{_node_list};
|
61
|
0
|
0
|
|
|
|
|
return scalar(@$child_node_list) ? TRUE : FALSE;
|
62
|
|
|
|
|
|
|
}
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#insertBefore
|
65
|
|
|
|
|
|
|
#removeChild
|
66
|
|
|
|
|
|
|
#replaceChild
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1;
|
70
|
|
|
|
|
|
|
__END__
|