| 1 | package XML::XMetaL::Mock::DOMNode; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 3 | ▶ | use 5.008; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 3 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 3 | ▶ | use Hash::Util qw(lock_keys); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 3 | ▶ | use XML::XMetaL::Mock::DOMNodeList; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 3 | ▶ | use constant TRUE => 1; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 3 | ▶ | use constant FALSE => 0; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 3 | our @keys = qw( | |||||||||||||||||||
| 16 | nodeID | ||||||||||||||||||||
| 17 | attributes | ||||||||||||||||||||
| 18 | childNodes | ||||||||||||||||||||
| 19 | firstChild | ||||||||||||||||||||
| 20 | lastChild | ||||||||||||||||||||
| 21 | nextSibling | ||||||||||||||||||||
| 22 | nodeName | ||||||||||||||||||||
| 23 | nodeType | ||||||||||||||||||||
| 24 | nodeValue | ||||||||||||||||||||
| 25 | ownerDocument | ||||||||||||||||||||
| 26 | parentNode | ||||||||||||||||||||
| 27 | previousSibling | ||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 3 | our %node_types = ( | |||||||||||||||||||
| 31 | DOMElement => 1, | ||||||||||||||||||||
| 32 | DOMAttr => 2, | ||||||||||||||||||||
| 33 | DOMText => 3, | ||||||||||||||||||||
| 34 | DOMCDATASection => 4, | ||||||||||||||||||||
| 35 | DOMEntityReference => 5, | ||||||||||||||||||||
| 36 | DOMEntity => 6, | ||||||||||||||||||||
| 37 | DOMProcessingInstruction => 7, | ||||||||||||||||||||
| 38 | DOMComment => 8, | ||||||||||||||||||||
| 39 | DOMDocument => 9, | ||||||||||||||||||||
| 40 | DOMDocumentType => 10, | ||||||||||||||||||||
| 41 | DOMDocumentFragment => 11, | ||||||||||||||||||||
| 42 | DOMNotation => 12, | ||||||||||||||||||||
| 43 | DOMCharacterReference => 505, | ||||||||||||||||||||
| 44 | ); | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 6 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||
| 47 | 6 | my ($class, %args) = @_; | |||||||||||||||||||
| 48 | 6 | my $self; | |||||||||||||||||||
| 49 | 6 | eval { | |||||||||||||||||||
| 50 | 6 | my %properties; | |||||||||||||||||||
| 51 | 6 | @properties{@keys} = @args{@keys}; | |||||||||||||||||||
| 52 | 6 | ▶ | $self = bless \%properties, ref($class) || $class; | ||||||||||||||||||
|
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
| |||||||||||||||||||||
| 53 | #lock_keys(%$self, @keys); | ||||||||||||||||||||
| 54 | 6 | $self->{childNodes} = XML::XMetaL::Mock::DOMNodeList->new(); | |||||||||||||||||||
| 55 | 6 | $self->_set_node_type(); | |||||||||||||||||||
| 56 | }; | ||||||||||||||||||||
| 57 | 6 | ▶ | croak $@ if $@; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 58 | 6 | return $self; | |||||||||||||||||||
| 59 | } | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 6 | ▶ | sub _set_node_type { | ||||||||||||||||||
|
Subroutine
_set_node_type: called CC=3 SCAR=11.8
| |||||||||||||||||||||
| 62 | 6 | my ($self) = @_; | |||||||||||||||||||
| 63 | 6 | my $class = ref $self; | |||||||||||||||||||
| 64 | 6 | my ($key) = $class =~ /([^:]+)$/; | |||||||||||||||||||
| 65 | croak "Node name ".($key || "FALSE")." does not exist" | ||||||||||||||||||||
| 66 | 6 | ▶ | unless exists $node_types{$key}; | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$key || 'FALSE'
MC/DC0%0/1
$key || 'FALSE'
$key
Truth table0%0/2
A
A= $key
| |||||||||||||||||||||
| 67 | 6 | my $node_type = $node_types{$key}; | |||||||||||||||||||
| 68 | 6 | $self->{nodeType} = $node_type; | |||||||||||||||||||
| 69 | } | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 3 | ▶ | sub appendChild { | ||||||||||||||||||
|
Subroutine
appendChild: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||
| 72 | 3 | eval { | |||||||||||||||||||
| 73 | 3 | my $self = shift @_; | |||||||||||||||||||
| 74 | 3 | ▶ | my XML::XMetaL::Mock::DOMNode $child_node = shift(@_) || croak("Missing argument"); | ||||||||||||||||||
|
Condition50%1/2
shift @_ || croak('Missing argument')
MC/DC0%0/1
shift @_ || croak('Missing argument')
shift @_
Truth table50%1/2
A
A= shift @_
| |||||||||||||||||||||
| 75 | 3 | my XML::XMetaL::Mock::DOMNodeList $child_node_list = $self->{childNodes}; | |||||||||||||||||||
| 76 | 3 | $child_node->{parentNode} = $self; | |||||||||||||||||||
| 77 | 3 | $child_node_list->add($child_node); | |||||||||||||||||||
| 78 | }; | ||||||||||||||||||||
| 79 | 3 | ▶ | croak $@ if $@; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 80 | } | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | #cloneNode | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | 0 | ▶ | sub hasChildNodes { | ||||||||||||||||||
|
Subroutine
hasChildNodes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 85 | 0 | my $self = shift @_; | |||||||||||||||||||
| 86 | 0 | my XML::XMetaL::Mock::DOMNodeList $child_node_list = $self->{childNodes}; | |||||||||||||||||||
| 87 | 0 | return $child_node_list->hasChildNodes(); | |||||||||||||||||||
| 88 | } | ||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | #insertBefore | ||||||||||||||||||||
| 91 | #removeChild | ||||||||||||||||||||
| 92 | #replaceChild | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | 3 | 1; | |||||||||||||||||||
| 96 | __END__ | ||||||||||||||||||||