line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package YAX::Text; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
99
|
|
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
15
|
use base qw/YAX::Node/; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
636
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
19
|
use Scalar::Util qw/weaken/; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
229
|
|
8
|
3
|
|
|
3
|
|
16
|
use YAX::Constants qw/TEXT_NODE/; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
181
|
|
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
16
|
use overload '""' => \&as_string, fallback => 1; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
20
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub TEXT () { 0 } |
13
|
|
|
|
|
|
|
sub PRNT () { 1 } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
51
|
|
|
51
|
0
|
73
|
my ( $class, $data ) = @_; |
17
|
51
|
|
|
|
|
222
|
bless [ $data, undef ], $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
6
|
|
|
6
|
1
|
631
|
sub type { TEXT_NODE } |
21
|
414
|
|
|
414
|
1
|
1170
|
sub name { '#text' } |
22
|
4
|
50
|
|
4
|
1
|
16
|
sub data { $_[0][TEXT] = $_[1] if @_ == 2; $_[0][TEXT] } |
|
4
|
|
|
|
|
22
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub clone { |
25
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
26
|
0
|
|
|
|
|
0
|
return ref( $self )->new( $self->data ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
54
|
100
|
|
54
|
1
|
383
|
sub parent { weaken( $_[0][PRNT] = $_[1] ) if @_ == 2; $_[0][PRNT] } |
|
54
|
|
|
|
|
164
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub as_string { |
32
|
4
|
50
|
|
4
|
1
|
186
|
return '' unless defined $_[0][TEXT]; |
33
|
4
|
50
|
|
|
|
14
|
return '' unless length ($_[0][TEXT]); |
34
|
4
|
|
|
|
|
21
|
$_[0][TEXT]; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub entityfy { |
38
|
0
|
|
|
0
|
0
|
|
my $text = shift; |
39
|
0
|
|
|
|
|
|
$text =~ s/&/&/g; |
40
|
0
|
|
|
|
|
|
$text =~ s/</g; |
41
|
0
|
|
|
|
|
|
$text =~ s/>/>/g; |
42
|
0
|
|
|
|
|
|
$text =~ s/'/'/g; |
43
|
0
|
|
|
|
|
|
$text =~ s/"/"/g; |
44
|
0
|
|
|
|
|
|
$text; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
__END__ |