line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CAM::XML::Text; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
229
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
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., |
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
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
0
|
1
|
|
my $pkg = shift; |
34
|
0
|
|
0
|
|
|
|
my $type = shift || 'none'; |
35
|
0
|
|
|
|
|
|
my $text = shift; |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
if (!defined $text) |
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
|
|
|
|
|
|
|
{ |
53
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
54
|
0
|
0
|
|
|
|
|
return $self->{type} eq 'text' ? CAM::XML->_XML_escape($self->{text}) ##no critic for use of private sub |
|
|
0
|
|
|
|
|
|
55
|
|
|
|
|
|
|
: $self->{type} eq 'cdata' ? CAM::XML->_CDATA_escape($self->{text}) ##no critic for use of private sub |
56
|
|
|
|
|
|
|
: $self->{text}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item $self->getInnerText() |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub getInnerText |
64
|
|
|
|
|
|
|
{ |
65
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
66
|
0
|
|
|
|
|
|
return $self->{text}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _get_path_nodes |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
0
|
|
|
my $self = shift; |
72
|
0
|
|
|
|
|
|
my $path = shift; |
73
|
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
return $path ? () : ($self); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
__END__ |