line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package YAPE::HTML::Element; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = '1.10'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
64
|
|
|
64
|
1
|
300
|
sub text { $_[0]{TEXT} } |
7
|
55
|
|
|
55
|
1
|
89
|
sub string { $_[0]->text } |
8
|
65
|
|
|
65
|
1
|
171
|
sub fullstring { $_[0]->string } |
9
|
163
|
|
|
163
|
1
|
829
|
sub type { $_[0]{TYPE} } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package YAPE::HTML::tag; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
87
|
|
|
87
|
|
157
|
my ($class, $tag, $attr, $text, $closed, $impl) = @_; |
16
|
87
|
|
50
|
|
|
1058
|
bless { |
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
17
|
|
|
|
|
|
|
TYPE => 'tag', |
18
|
|
|
|
|
|
|
TAG => $tag, |
19
|
|
|
|
|
|
|
ATTR => $attr || {}, |
20
|
|
|
|
|
|
|
TEXT => $text || [], |
21
|
|
|
|
|
|
|
CLOSED => $closed || 0, |
22
|
|
|
|
|
|
|
IMPLIED => $impl || 0, |
23
|
|
|
|
|
|
|
}, $class; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub string { |
27
|
43
|
|
|
43
|
|
52
|
my $self = shift; |
28
|
43
|
|
|
|
|
71
|
my $str = "<$self->{TAG}"; |
29
|
43
|
|
|
|
|
47
|
for (sort keys %{ $self->{ATTR} }) { |
|
43
|
|
|
|
|
201
|
|
30
|
13
|
|
|
|
|
19
|
$str .= " $_"; |
31
|
13
|
50
|
|
|
|
31
|
if (defined $self->{ATTR}{$_}) { |
32
|
13
|
|
|
|
|
36
|
$str .= "=" . YAPE::HTML::quote($self->{ATTR}{$_}); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
43
|
100
|
|
|
|
110
|
$str .= " /" if $self->{IMPLIED}; |
36
|
43
|
|
|
|
|
45
|
$str .= ">"; |
37
|
43
|
|
|
|
|
79
|
return $str; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub fullstring { |
41
|
52
|
|
|
52
|
|
92
|
my $self = shift; |
42
|
52
|
|
|
|
|
87
|
my ($taghash, $taglist) = ({}, []); |
43
|
52
|
100
|
|
|
|
149
|
@$taghash{@{ $taglist = shift }} = () if ref $_[0]; |
|
24
|
|
|
|
|
48
|
|
44
|
52
|
100
|
|
|
|
98
|
my $d = @_ ? $_[0] : -1; |
45
|
52
|
|
|
|
|
46
|
my $str; |
46
|
|
|
|
|
|
|
|
47
|
52
|
100
|
100
|
|
|
254
|
$str = $self->string if $d and not exists $taghash->{$self->{TAG}}; |
48
|
52
|
|
|
|
|
203
|
$str .= join "", map |
49
|
|
|
|
|
|
|
$_->fullstring($taglist, $d > 0 ? $d-1 : $d), |
50
|
52
|
100
|
|
|
|
62
|
@{ $self->{TEXT} }; |
51
|
52
|
100
|
100
|
|
|
332
|
$str .= "$self->{TAG}>" if |
|
|
|
100
|
|
|
|
|
52
|
|
|
|
|
|
|
$self->{CLOSED} and $d and not exists $taghash->{$self->{TAG}}; |
53
|
52
|
|
|
|
|
358
|
return $str; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub get_attr { |
57
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
58
|
0
|
0
|
|
|
|
0
|
return %{ $self->{ATTR} } if not @_; |
|
0
|
|
|
|
|
0
|
|
59
|
0
|
0
|
|
|
|
0
|
return $self->{ATTR}{$_[0]} if @_ == 1; |
60
|
0
|
|
|
|
|
0
|
return @{ $self->{ATTR} }{map lc, @_}; |
|
0
|
|
|
|
|
0
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub has_attr { |
64
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
65
|
0
|
0
|
|
|
|
0
|
return exists $self->{ATTR}{lc $_[0]} if @_ == 1; |
66
|
0
|
|
|
|
|
0
|
return map exists $self->{ATTR}{lc $_}, @_; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub set_attr { |
70
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
71
|
0
|
|
|
|
|
0
|
while (my $k = shift) { $self->{ATTR}{lc $k} = shift } |
|
0
|
|
|
|
|
0
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub rem_attr { |
75
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
76
|
0
|
|
|
|
|
0
|
delete @{ $self->{ATTR} }{map lc, @_}; |
|
0
|
|
|
|
|
0
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
0
|
|
0
|
sub closed { $_[0]{CLOSED} } |
80
|
0
|
|
|
0
|
|
0
|
sub implied_closed { $_[0]{IMPLIED} } |
81
|
1
|
|
|
1
|
|
10
|
sub tag { $_[0]{TAG} } |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
package YAPE::HTML::closetag; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub new { |
88
|
71
|
|
|
71
|
|
118
|
my ($class, $tag) = @_; |
89
|
71
|
|
|
|
|
706
|
bless { TYPE => 'closetag', TAG => $tag }, $class; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
0
|
|
0
|
sub string { "$_[0]{TAG}>" } |
93
|
0
|
|
|
0
|
|
0
|
sub tag { $_[0]{TAG} } |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
package YAPE::HTML::text; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub new { |
100
|
136
|
|
|
136
|
|
259
|
my ($class, $text) = @_; |
101
|
136
|
|
|
|
|
668
|
bless { TYPE => 'text', TEXT => $text }, $class; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
package YAPE::HTML::comment; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub new { |
109
|
18
|
|
|
18
|
|
34
|
my ($class, $comment) = @_; |
110
|
18
|
|
|
|
|
86
|
bless { TYPE => 'comment', TEXT => $comment }, $class; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
9
|
|
|
9
|
|
74
|
sub string { "" } |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
package YAPE::HTML::dtd; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub new { |
120
|
1
|
|
|
1
|
|
1
|
my ($class, $attr) = @_; |
121
|
1
|
|
|
|
|
2
|
my $hattr; |
122
|
|
|
|
|
|
|
|
123
|
1
|
|
50
|
|
|
6
|
$attr ||= []; |
124
|
1
|
|
|
|
|
2
|
@{$hattr}{@$attr} = (); |
|
1
|
|
|
|
|
3
|
|
125
|
1
|
|
|
|
|
7
|
bless { TYPE => 'dtd', ATTR => $attr, HATTR => $hattr }, $class; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
0
|
|
|
0
|
|
0
|
sub get_attr { @{ $_[0]{ATTR} } } |
|
0
|
|
|
|
|
0
|
|
129
|
0
|
|
|
0
|
|
0
|
sub set_attr { @{ $_[0]{HATTR} }{ @{ $_[0]{ATTR} } = @_[1..$#_] } = () } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
130
|
1
|
|
|
1
|
|
3
|
sub string { "" } |
|
1
|
|
|
|
|
8
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
package YAPE::HTML::pi; |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub new { |
137
|
0
|
|
|
0
|
|
0
|
my ($class, $name, $attr) = @_; |
138
|
0
|
|
0
|
|
|
0
|
bless { TYPE => 'pi', NAME => $name, ATTR => $attr || {} }, $class; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub string { |
142
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
143
|
0
|
|
|
|
|
0
|
my $str = "$self->{NAME}"; |
144
|
0
|
|
|
|
|
0
|
for (sort keys %{ $self->{ATTR} }) { |
|
0
|
|
|
|
|
0
|
|
145
|
0
|
|
|
|
|
0
|
$str .= " $_"; |
146
|
0
|
0
|
|
|
|
0
|
if (defined $self->{ATTR}{$_}) { |
147
|
0
|
|
|
|
|
0
|
$str .= "=" . YAPE::HTML::quote($self->{ATTR}{$_}); |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
} |
150
|
0
|
|
|
|
|
0
|
$str .= "?>"; |
151
|
0
|
|
|
|
|
0
|
return $str; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub get_attr { |
155
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
156
|
0
|
0
|
|
|
|
0
|
return %{ $self->{ATTR} } if not @_; |
|
0
|
|
|
|
|
0
|
|
157
|
0
|
0
|
|
|
|
0
|
return $self->{ATTR}{$_[0]} if @_ == 1; |
158
|
0
|
|
|
|
|
0
|
return @{ $self->{ATTR} }{map lc, @_}; |
|
0
|
|
|
|
|
0
|
|
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub has_attr { |
162
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
163
|
0
|
0
|
|
|
|
0
|
return exists $self->{ATTR}{lc $_[0]} if @_ == 1; |
164
|
0
|
|
|
|
|
0
|
return map exists $self->{ATTR}{lc $_}, @_; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub set_attr { |
168
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
169
|
0
|
|
|
|
|
0
|
while (my $k = shift) { $self->{ATTR}{lc $k} = shift } |
|
0
|
|
|
|
|
0
|
|
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub rem_attr { |
173
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
174
|
0
|
|
|
|
|
0
|
delete @{ $self->{ATTR} }{map lc, @_}; |
|
0
|
|
|
|
|
0
|
|
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
0
|
|
|
0
|
|
0
|
sub name { $_[0]{NAME} } |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
package YAPE::HTML::ssi; |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub new { |
184
|
3
|
|
|
3
|
|
4
|
my ($class, $com, $attr) = @_; |
185
|
3
|
|
50
|
|
|
22
|
bless { TYPE => 'ssi', COM => $com, ATTR => $attr || {} }, $class; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub string { |
189
|
2
|
|
|
2
|
|
5
|
my $self = shift; |
190
|
2
|
|
|
|
|
4
|
my $str = ""; |
198
|
2
|
|
|
|
|
18
|
return $str; |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub get_attr { |
202
|
0
|
|
|
0
|
|
|
my $self = shift; |
203
|
0
|
0
|
|
|
|
|
return %{ $self->{ATTR} } if not @_; |
|
0
|
|
|
|
|
|
|
204
|
0
|
0
|
|
|
|
|
return $self->{ATTR}{$_[0]} if @_ == 1; |
205
|
0
|
|
|
|
|
|
return @{ $self->{ATTR} }{map lc, @_}; |
|
0
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub has_attr { |
209
|
0
|
|
|
0
|
|
|
my $self = shift; |
210
|
0
|
0
|
|
|
|
|
return exists $self->{ATTR}{lc $_[0]} if @_ == 1; |
211
|
0
|
|
|
|
|
|
return map exists $self->{ATTR}{lc $_}, @_; |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
sub set_attr { |
215
|
0
|
|
|
0
|
|
|
my $self = shift; |
216
|
0
|
|
|
|
|
|
while (my $k = shift) { $self->{ATTR}{lc $k} = shift } |
|
0
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
sub rem_attr { |
220
|
0
|
|
|
0
|
|
|
my $self = shift; |
221
|
0
|
|
|
|
|
|
delete @{ $self->{ATTR} }{map lc, @_}; |
|
0
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
0
|
|
|
sub command { $_[0]{COM} } |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
1; |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
__END__ |