| 1 | package XML::XPath::Node::Comment; | ||
| 2 | |||
| 3 | 1 | $VERSION = '1.26'; | |
| 4 | |||
| 5 | 1 | ▶ | use strict; use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use vars qw/@ISA/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 1 | @ISA = ('XML::XPath::Node'); | |
| 9 | |||
| 10 | package XML::XPath::Node::CommentImpl; | ||
| 11 | |||
| 12 | 1 | ▶ | use vars qw/@ISA/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 1 | @ISA = ('XML::XPath::NodeImpl', 'XML::XPath::Node::Comment'); | |
| 14 | 1 | ▶ | use XML::XPath::Node ':node_keys'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | |||
| 16 | sub new { | ||
| 17 | 0 | ▶ | my $class = shift; |
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||
| 18 | 0 | my ($comment) = @_; | |
| 19 | |||
| 20 | 0 | my $pos = XML::XPath::Node->nextPos; | |
| 21 | |||
| 22 | 0 | my @vals; | |
| 23 | 0 | @vals[node_global_pos, node_comment] = | |
| 24 | ($pos, $comment); | ||
| 25 | 0 | my $self = \@vals; | |
| 26 | |||
| 27 | 0 | bless $self, $class; | |
| 28 | } | ||
| 29 | |||
| 30 | 0 | ▶ | sub getNodeType { COMMENT_NODE } |
|
Subroutine
getNodeType: not called CC=1 SCAR=6.9
| |||
| 31 | |||
| 32 | 0 | ▶ | sub isCommentNode { 1; } |
|
Subroutine
isCommentNode: not called CC=1 SCAR=6.9
| |||
| 33 | |||
| 34 | sub getNodeValue { | ||
| 35 | 0 | ▶ | return shift->[node_comment]; |
|
Subroutine
getNodeValue: not called CC=1 SCAR=6.9
| |||
| 36 | } | ||
| 37 | |||
| 38 | sub getData { | ||
| 39 | 0 | ▶ | shift->getNodeValue; |
|
Subroutine
getData: not called CC=1 SCAR=6.9
| |||
| 40 | } | ||
| 41 | |||
| 42 | sub setNodeValue { | ||
| 43 | 0 | ▶ | shift->[node_comment] = shift; |
|
Subroutine
setNodeValue: not called CC=1 SCAR=6.9
| |||
| 44 | } | ||
| 45 | |||
| 46 | sub _to_sax { | ||
| 47 | 0 | ▶ | my $self = shift; |
|
Subroutine
_to_sax: not called CC=1 SCAR=6.9
| |||
| 48 | 0 | my ($doch, $dtdh, $enth) = @_; | |
| 49 | |||
| 50 | 0 | $doch->comment( { Data => $self->getValue } ); | |
| 51 | } | ||
| 52 | |||
| 53 | sub comment_escape { | ||
| 54 | 0 | ▶ | my $data = shift; |
|
Subroutine
comment_escape: not called CC=1 SCAR=6.9
| |||
| 55 | 0 | $data =~ s/--/--/g; | |
| 56 | 0 | return $data; | |
| 57 | } | ||
| 58 | |||
| 59 | sub string_value { | ||
| 60 | 0 | ▶ | my $self = shift; |
|
Subroutine
string_value: not called CC=1 SCAR=6.9
| |||
| 61 | 0 | return $self->[node_comment]; | |
| 62 | } | ||
| 63 | |||
| 64 | sub toString { | ||
| 65 | 0 | ▶ | my $self = shift; |
|
Subroutine
toString: not called CC=1 SCAR=6.9
| |||
| 66 | 0 | return '<!--' . comment_escape($self->[node_comment]) . '-->'; | |
| 67 | } | ||
| 68 | |||
| 69 | 1 | 1; | |
| 70 | __END__ | ||