XPath/Node/Attribute.pm

filter: Statementstmt 37.7% 20 / 53 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 29.4% 5 / 17 Podpod n/a totaltotal 32.4% 25 / 77 CC 3 SCAR 12.0
CC
3
Cov
34%
getNamespace
12.0
new
2.0
getNodeType
2.0
CRAP 3.3
« XPath/Node/Namespace.pm ↑ Summary XPath/Boolean.pm »
1 package XML::XPath::Node::Attribute;
2  
3 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use vars qw/@ISA $VERSION/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 @ISA = ('XML::XPath::Node');
7 1 $VERSION = '1.26';
8  
9 package XML::XPath::Node::AttributeImpl;
10  
11 1 ▶use vars qw/@ISA $VERSION/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 @ISA = ('XML::XPath::NodeImpl', 'XML::XPath::Node::Attribute');
13 1 ▶use XML::XPath::Node ':node_keys';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 $VERSION = '1.26';
16  
17 sub new {
18 0 ▶ my $class = shift;
Subroutine new: not called CC=1 SCAR=6.9
19 0 my ($key, $val, $prefix) = @_;
20  
21 0 my $pos = XML::XPath::Node->nextPos;
22  
23 0 my @vals;
24 0 @vals[node_global_pos, node_prefix, node_key, node_value] =
25 ($pos, $prefix, $key, $val);
26 0 my $self = \@vals;
27  
28 0 bless $self, $class;
29  
30 }
31  
32 0 ▶sub getNodeType { ATTRIBUTE_NODE }
Subroutine getNodeType: not called CC=1 SCAR=6.9
33  
34 0 ▶sub isAttributeNode { 1; }
Subroutine isAttributeNode: not called CC=1 SCAR=6.9
35  
36 sub getName {
37 0 ▶ my $self = shift;
Subroutine getName: not called CC=1 SCAR=6.9
38 0 $self->[node_key];
39 }
40  
41 sub getLocalName {
42 0 ▶ my $self = shift;
Subroutine getLocalName: not called CC=1 SCAR=6.9
43 0 my $local = $self->[node_key];
44 0 $local =~ s/.*://;
45 0 return $local;
46 }
47  
48 sub getNodeValue {
49 0 ▶ my $self = shift;
Subroutine getNodeValue: not called CC=1 SCAR=6.9
50 0 $self->[node_value];
51 }
52  
53 sub getData {
54 0 ▶ shift->getNodeValue(@_);
Subroutine getData: not called CC=1 SCAR=6.9
55 }
56  
57 sub setNodeValue {
58 0 ▶ my $self = shift;
Subroutine setNodeValue: not called CC=1 SCAR=6.9
59 0 $self->[node_value] = shift;
60 }
61  
62 sub getPrefix {
63 0 ▶ my $self = shift;
Subroutine getPrefix: not called CC=1 SCAR=6.9
64 0 $self->[node_prefix];
65 }
66  
67 sub string_value {
68 0 ▶ my $self = shift;
Subroutine string_value: not called CC=1 SCAR=6.9
69 0 return $self->[node_value];
70 }
71  
72 sub toString {
73 0 ▶ my $self = shift;
Subroutine toString: not called CC=1 SCAR=6.9
74 0 my $string = ' ';
75 # if ($self->[node_prefix]) {
76 # $string .= $self->[node_prefix] . ':';
77 # }
78 0 $string .= join('',
79 $self->[node_key],
80 '="',
81 XML::XPath::Node::XMLescape($self->[node_value], '"&><'),
82 '"');
83 0 return $string;
84 }
85  
86 sub getNamespace {
87 0 ▶ my $self = shift;
Subroutine getNamespace: not called CC=3 SCAR=24.8
88 0 my ($prefix) = @_;
89 0 ▶ $prefix ||= $self->getPrefix;
Condition0%0/3
$prefix ||= $self->getPrefix
l!l&&r!l&&!r
000
MC/DC0%0/2
$prefix ||= $self->getPrefix
$prefix $self->getPrefix
Truth table0%0/3
A ||= B
A= $prefixB= $self->getPrefix
ABresult
1X1
011
000
90 0 ▶ if (my $parent = $self->getParentNode) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $parent = $self->getParentNode) 0 0 0
91 0 return $parent->getNamespace($prefix);
92 }
93 }
94  
95 1 1;
96 __END__
« XPath/Node/Namespace.pm ↑ Summary XPath/Boolean.pm »