line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::HTML::Variable; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
72
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
428
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub op_factory { |
7
|
24
|
|
|
24
|
1
|
52
|
my ($op) = @_; |
8
|
|
|
|
|
|
|
|
9
|
24
|
0
|
|
0
|
|
2278
|
return eval q|sub { |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
50
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
7
|
|
|
|
|
816
|
|
|
7
|
|
|
|
|
21
|
|
|
0
|
|
|
|
|
0
|
|
|
7
|
|
|
|
|
53
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
10
|
|
|
|
|
|
|
my ($self, $str) = @_; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
if ( ref $str eq __PACKAGE__) { |
13
|
|
|
|
|
|
|
return $self->{value} | . $op . q| $str->{value}; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
else { |
16
|
|
|
|
|
|
|
return $self->{value} | . $op . q| $str; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
}|; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use overload |
22
|
2
|
|
|
|
|
13
|
'""' => \&html_encoded, |
23
|
|
|
|
|
|
|
'.' => \&concat, |
24
|
|
|
|
|
|
|
'.=' => \&concatequals, |
25
|
|
|
|
|
|
|
'=' => \&clone, |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
'cmp' => op_factory('cmp'), |
28
|
|
|
|
|
|
|
'eq' => op_factory('eq'), |
29
|
|
|
|
|
|
|
'<=>' => op_factory('<=>'), |
30
|
|
|
|
|
|
|
'==' => op_factory('=='), |
31
|
|
|
|
|
|
|
'%' => op_factory('%'), |
32
|
|
|
|
|
|
|
'+' => op_factory('+'), |
33
|
|
|
|
|
|
|
'-' => op_factory('-'), |
34
|
|
|
|
|
|
|
'*' => op_factory('*'), |
35
|
|
|
|
|
|
|
'/' => op_factory('/'), |
36
|
|
|
|
|
|
|
'**' => op_factory('**'), |
37
|
|
|
|
|
|
|
'>>' => op_factory('>>'), |
38
|
|
|
|
|
|
|
'<<' => op_factory('<<'), |
39
|
2
|
|
|
2
|
|
12
|
; |
|
2
|
|
|
|
|
17
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new { |
42
|
27
|
|
|
27
|
1
|
111
|
my ($class, $value) = @_; |
43
|
|
|
|
|
|
|
|
44
|
27
|
|
|
|
|
168
|
my $self = bless { value => $value }, $class; |
45
|
|
|
|
|
|
|
|
46
|
27
|
|
|
|
|
108
|
return $self; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub plain { |
50
|
8
|
|
|
8
|
1
|
13
|
my $self = shift; |
51
|
|
|
|
|
|
|
|
52
|
8
|
|
|
|
|
48
|
return $self->{value}; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub html_encoded { |
56
|
6
|
|
|
6
|
1
|
5878
|
my $self = shift; |
57
|
|
|
|
|
|
|
|
58
|
6
|
|
|
|
|
202
|
my $value = $self->{value}; |
59
|
|
|
|
|
|
|
|
60
|
6
|
|
|
|
|
14
|
for ($value) { |
61
|
6
|
|
|
|
|
20
|
s/&/&/g; |
62
|
6
|
|
|
|
|
18
|
s/</g; |
63
|
6
|
|
|
|
|
14
|
s/>/>/g; |
64
|
6
|
|
|
|
|
15
|
s/"/"/g; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
6
|
|
|
|
|
37
|
return $value; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub concat { |
71
|
38
|
|
|
38
|
1
|
737
|
my ($self, $str, $prefix) = @_; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Special case where we're _not_ going to html_encode now now |
74
|
38
|
50
|
66
|
|
|
213
|
return $self->clone() if not defined $str or $str eq ''; |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
0
|
if ( $prefix ) { |
77
|
0
|
|
|
|
|
0
|
return $str . $self->html_encoded(); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
else { |
80
|
0
|
|
|
|
|
0
|
return $self->html_encoded() . $str; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub concatequals { |
85
|
0
|
|
|
0
|
1
|
0
|
my ($self, $str, $prefix) = @_; |
86
|
|
|
|
|
|
|
|
87
|
0
|
0
|
|
|
|
0
|
if ( ref $str eq __PACKAGE__) { |
88
|
0
|
|
|
|
|
0
|
$self->{value} .= $str->{value}; |
89
|
0
|
|
|
|
|
0
|
return $self; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
else { |
92
|
|
|
|
|
|
|
# Special case where we're _not_ going to html_encode now now |
93
|
0
|
0
|
|
|
|
0
|
return $self->clone() if $str eq ''; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
0
|
$self->{value} .= $str; |
96
|
0
|
|
|
|
|
0
|
return $self->html_encoded . $str; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub clone { |
101
|
38
|
|
|
38
|
1
|
43
|
my $self = shift; |
102
|
|
|
|
|
|
|
|
103
|
38
|
|
|
|
|
145
|
my $clone = bless { %$self }, ref $self; |
104
|
|
|
|
|
|
|
|
105
|
38
|
|
|
|
|
124
|
return $clone; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |
109
|
|
|
|
|
|
|
__END__ |