| 1 | package CAM::XML::Text; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | |||||||||||||||
| 6 | 2 | our $VERSION = '1.14'; | |||||||||||||
| 7 | |||||||||||||||
| 8 | =head1 NAME | ||||||||||||||
| 9 | |||||||||||||||
| 10 | CAM::XML::Text - XML text nodes | ||||||||||||||
| 11 | |||||||||||||||
| 12 | =head1 LICENSE | ||||||||||||||
| 13 | |||||||||||||||
| 14 | Copyright 2006 Clotho Advanced Media, Inc., <cpan@clotho.com> | ||||||||||||||
| 15 | |||||||||||||||
| 16 | This library is free software; you can redistribute it and/or modify it | ||||||||||||||
| 17 | under the same terms as Perl itself. | ||||||||||||||
| 18 | |||||||||||||||
| 19 | =head1 DESCRIPTION | ||||||||||||||
| 20 | |||||||||||||||
| 21 | This is a helper class to hold text data | ||||||||||||||
| 22 | |||||||||||||||
| 23 | =head1 FUNCTIONS | ||||||||||||||
| 24 | |||||||||||||||
| 25 | =over | ||||||||||||||
| 26 | |||||||||||||||
| 27 | =item $pkg->new($type, $text) | ||||||||||||||
| 28 | |||||||||||||||
| 29 | =cut | ||||||||||||||
| 30 | |||||||||||||||
| 31 | sub new | ||||||||||||||
| 32 | 0 | ▶ | { | ||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||
| 33 | 0 | my $pkg = shift; | |||||||||||||
| 34 | 0 | ▶ | my $type = shift || 'none'; | ||||||||||||
|
Condition0%0/2
shift() || 'none'
MC/DC0%0/1
shift() || 'none'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||
| 35 | 0 | my $text = shift; | |||||||||||||
| 36 | |||||||||||||||
| 37 | 0 | ▶ | if (!defined $text) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 38 | { | ||||||||||||||
| 39 | 0 | $text = q{}; | |||||||||||||
| 40 | } | ||||||||||||||
| 41 | 0 | return bless { | |||||||||||||
| 42 | type => $type, | ||||||||||||||
| 43 | text => $text, | ||||||||||||||
| 44 | }, $pkg; | ||||||||||||||
| 45 | } | ||||||||||||||
| 46 | |||||||||||||||
| 47 | =item $self->toString() | ||||||||||||||
| 48 | |||||||||||||||
| 49 | =cut | ||||||||||||||
| 50 | |||||||||||||||
| 51 | sub toString | ||||||||||||||
| 52 | 0 | ▶ | { | ||||||||||||
|
Subroutine
toString: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||
| 53 | 0 | my $self = shift; | |||||||||||||
| 54 | return $self->{type} eq 'text' ? CAM::XML->_XML_escape($self->{text}) ##no critic for use of private sub | ||||||||||||||
| 55 | : $self->{type} eq 'cdata' ? CAM::XML->_CDATA_escape($self->{text}) ##no critic for use of private sub | ||||||||||||||
| 56 | 0 | ▶ | : $self->{text}; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 57 | } | ||||||||||||||
| 58 | |||||||||||||||
| 59 | =item $self->getInnerText() | ||||||||||||||
| 60 | |||||||||||||||
| 61 | =cut | ||||||||||||||
| 62 | |||||||||||||||
| 63 | sub getInnerText | ||||||||||||||
| 64 | 0 | ▶ | { | ||||||||||||
|
Subroutine
getInnerText: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 65 | 0 | my $self = shift; | |||||||||||||
| 66 | 0 | return $self->{text}; | |||||||||||||
| 67 | } | ||||||||||||||
| 68 | |||||||||||||||
| 69 | sub _get_path_nodes | ||||||||||||||
| 70 | 0 | ▶ | { | ||||||||||||
|
Subroutine
_get_path_nodes: not called CC=2 SCAR=17.9
| |||||||||||||||
| 71 | 0 | my $self = shift; | |||||||||||||
| 72 | 0 | my $path = shift; | |||||||||||||
| 73 | |||||||||||||||
| 74 | 0 | ▶ | return $path ? () : ($self); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 75 | } | ||||||||||||||
| 76 | |||||||||||||||
| 77 | 2 | 1; | |||||||||||||
| 78 | __END__ | ||||||||||||||