| 1 | package XML::XMetaL::Mock::DOMNodeList; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 4 | ▶ | use 5.008; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 4 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 4 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 4 | ▶ | use Hash::Util qw(lock_keys); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 4 | ▶ | use constant TRUE => 1; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 4 | ▶ | use constant FALSE => 0; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 6 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.6
Pod
undocumented
| |||||||||||||||||||||
| 14 | 6 | my ($class, @items) = @_; | |||||||||||||||||||
| 15 | 6 | my $self; | |||||||||||||||||||
| 16 | 6 | eval { | |||||||||||||||||||
| 17 | #lock_keys(%args,qw()); | ||||||||||||||||||||
| 18 | 6 | ▶ | $self = bless { | ||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||
| 19 | length => undef, | ||||||||||||||||||||
| 20 | _node_list => [], | ||||||||||||||||||||
| 21 | }, ref($class) || $class; | ||||||||||||||||||||
| 22 | 6 | lock_keys(%$self, keys %$self); | |||||||||||||||||||
| 23 | 6 | ▶ | $self->add(@items) if @items; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 24 | }; | ||||||||||||||||||||
| 25 | 6 | ▶ | croak $@ if $@; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 26 | 6 | return $self; | |||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 3 | ▶ | sub add { | ||||||||||||||||||
|
Subroutine
add: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 30 | 3 | my ($self, @items) = @_; | |||||||||||||||||||
| 31 | 3 | my $node_list = $self->{_node_list}; | |||||||||||||||||||
| 32 | #push @$node_list, grep {eval{$_->isa('XML::XMetaL::Mock::DOMNode')}} @items; | ||||||||||||||||||||
| 33 | 3 | my $last_node_in_list; | |||||||||||||||||||
| 34 | 3 | foreach my $item (@items) { | |||||||||||||||||||
| 35 | 3 | ▶ | if (scalar(@$node_list)) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 36 | 1 | $last_node_in_list = $$node_list[-1]; | |||||||||||||||||||
| 37 | 1 | $self->_link_to_next($last_node_in_list, $item); | |||||||||||||||||||
| 38 | #$self->_link_to_previous($last_node_in_list, $item); | ||||||||||||||||||||
| 39 | } | ||||||||||||||||||||
| 40 | 3 | push @$node_list, $item; | |||||||||||||||||||
| 41 | } | ||||||||||||||||||||
| 42 | 3 | $self->{length} = scalar @$node_list; | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 1 | ▶ | sub _link_to_next { | ||||||||||||||||||
|
Subroutine
_link_to_next: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 46 | 1 | my ($self, $previous_node, $next_node) = @_; | |||||||||||||||||||
| 47 | 1 | $previous_node->{nextSibling} = $next_node; | |||||||||||||||||||
| 48 | } | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 0 | ▶ | sub item { | ||||||||||||||||||
|
Subroutine
item: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 51 | 0 | my ($self, $index) = @_; | |||||||||||||||||||
| 52 | 0 | my $node_list = $self->{_node_list}; | |||||||||||||||||||
| 53 | 0 | return $$node_list[$index]; | |||||||||||||||||||
| 54 | } | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | #cloneNode | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 0 | ▶ | sub hasChildNodes { | ||||||||||||||||||
|
Subroutine
hasChildNodes: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 59 | 0 | my $self = shift @_; | |||||||||||||||||||
| 60 | 0 | my XML::XMetaL::Mock::DOMNodeList $child_node_list = $self->{_node_list}; | |||||||||||||||||||
| 61 | 0 | ▶ | return scalar(@$child_node_list) ? TRUE : FALSE; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 62 | } | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | #insertBefore | ||||||||||||||||||||
| 65 | #removeChild | ||||||||||||||||||||
| 66 | #replaceChild | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | 4 | 1; | |||||||||||||||||||
| 70 | __END__ | ||||||||||||||||||||