line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
96
|
|
2
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
139
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package |
5
|
|
|
|
|
|
|
XHTML::Instrumented::Control; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
3140
|
use Params::Validate qw (validate ARRAYREF HASHREF ); |
|
3
|
|
|
|
|
45344
|
|
|
3
|
|
|
|
|
2992
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new() |
10
|
|
|
|
|
|
|
{ |
11
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
12
|
0
|
|
|
|
|
|
my %p = Params::Validate::validate( @_, { |
13
|
|
|
|
|
|
|
src => 0, |
14
|
|
|
|
|
|
|
text => 0, |
15
|
|
|
|
|
|
|
args => 0, |
16
|
|
|
|
|
|
|
replace => 0, |
17
|
|
|
|
|
|
|
remove_tag => 0, |
18
|
|
|
|
|
|
|
remove => 0, |
19
|
|
|
|
|
|
|
id_count => 0, |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
); |
22
|
0
|
|
|
|
|
|
delete $p{remove}; |
23
|
0
|
|
|
|
|
|
bless({args => {}, @_}, $class); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub remove_self() |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
$self->{remove_tag} || 0; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub has_name |
34
|
|
|
|
|
|
|
{ |
35
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
exists $self->{args}{name}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub name |
41
|
|
|
|
|
|
|
{ |
42
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
$self->{args}{name}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub remove() |
48
|
|
|
|
|
|
|
{ |
49
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$self->{remove}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub args |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
57
|
0
|
|
|
|
|
|
my %args = @_; |
58
|
0
|
0
|
|
|
|
|
my %hash = ( %args, %{$self->{args} || {}} ); |
|
0
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
if (my $idc = $self->id_count) { |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
if ($hash{for}) { |
63
|
0
|
|
|
|
|
|
$hash{for} .= '.' . $idc; |
64
|
|
|
|
|
|
|
} |
65
|
0
|
0
|
|
|
|
|
if ($hash{id}) { |
66
|
0
|
|
|
|
|
|
$hash{id} .= '.' . $idc; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
%hash; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub eq |
74
|
|
|
|
|
|
|
{ |
75
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
76
|
0
|
|
|
|
|
|
my $ret = 0; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
for my $item (@_) { |
79
|
0
|
0
|
|
|
|
|
$ret = 1 if $item eq $self->{text}; |
80
|
|
|
|
|
|
|
} |
81
|
0
|
|
|
|
|
|
return $ret; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub if |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
0
|
|
|
|
!!($self->{text} || keys %{$self->{args} || {}}); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub _fixup |
92
|
|
|
|
|
|
|
{ |
93
|
0
|
|
|
0
|
|
|
my @ret; |
94
|
0
|
|
|
|
|
|
for my $data (@_) { |
95
|
0
|
0
|
|
|
|
|
next unless $data; |
96
|
0
|
|
|
|
|
|
$data =~ s/&/&/g; |
97
|
0
|
|
|
|
|
|
my $x = $data; |
98
|
|
|
|
|
|
|
# $data = Encode::decode_utf8( $x ); |
99
|
0
|
|
|
|
|
|
push @ret, $data; |
100
|
|
|
|
|
|
|
} |
101
|
0
|
|
|
|
|
|
@ret; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
##################### |
105
|
|
|
|
|
|
|
# |
106
|
|
|
|
|
|
|
# |
107
|
|
|
|
|
|
|
# |
108
|
|
|
|
|
|
|
sub exp_args |
109
|
|
|
|
|
|
|
{ |
110
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
111
|
|
|
|
|
|
|
|
112
|
0
|
0
|
|
|
|
|
die ref($_[0]), caller if ref($_[0]); |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
my %args = $self->args(@_); |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
my $nargs = { %args }; |
117
|
|
|
|
|
|
|
|
118
|
0
|
0
|
|
|
|
|
my $ret = join('', map({ defined($nargs->{$_}) ? qq( $_="$nargs->{$_}") : ''; } sort keys(%args))); |
|
0
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
$ret =~ s/&/&/g; |
120
|
0
|
|
|
|
|
|
return $ret; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
our %special_tag = ( a => 1, div => 1, textarea => 1 ); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub expand_content |
126
|
|
|
|
|
|
|
{ |
127
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
128
|
|
|
|
|
|
|
|
129
|
0
|
0
|
|
|
|
|
if ($self->{remove}) { |
130
|
0
|
|
|
|
|
|
return ''; |
131
|
|
|
|
|
|
|
} |
132
|
0
|
0
|
|
|
|
|
if (defined $self->{text}) { |
133
|
0
|
|
|
|
|
|
$self->{text}; |
134
|
|
|
|
|
|
|
} else { |
135
|
0
|
|
|
|
|
|
@_; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub children |
140
|
|
|
|
|
|
|
{ |
141
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
142
|
0
|
|
|
|
|
|
my %p = validate(@_, { |
143
|
|
|
|
|
|
|
children => ARRAYREF, |
144
|
|
|
|
|
|
|
context => { isa => 'XHTML::Instrumented::Context' }, |
145
|
|
|
|
|
|
|
}); |
146
|
0
|
|
|
|
|
|
my $context = $p{context}; |
147
|
0
|
|
|
|
|
|
my @ret; |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
for my $element (@{$p{children}}) { |
|
0
|
|
|
|
|
|
|
150
|
0
|
0
|
|
|
|
|
if (UNIVERSAL::isa($element, 'XHTML::Instrumented::Entry')) { |
151
|
0
|
|
|
|
|
|
push(@ret, $element->expand(context => $context)); |
152
|
|
|
|
|
|
|
} else { |
153
|
0
|
|
|
|
|
|
push(@ret, $element); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
} |
156
|
0
|
|
|
|
|
|
return @ret; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
3
|
|
|
3
|
|
2720
|
use Data::Dumper; |
|
3
|
|
|
|
|
15400
|
|
|
3
|
|
|
|
|
1947
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub to_text |
162
|
|
|
|
|
|
|
{ |
163
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
164
|
0
|
|
|
|
|
|
my %p = validate(@_, { |
165
|
|
|
|
|
|
|
tag => 1, |
166
|
|
|
|
|
|
|
children => ARRAYREF, |
167
|
|
|
|
|
|
|
args => HASHREF, |
168
|
|
|
|
|
|
|
flags => HASHREF, |
169
|
|
|
|
|
|
|
context => { isa => 'XHTML::Instrumented::Context' }, |
170
|
|
|
|
|
|
|
special => 0, |
171
|
|
|
|
|
|
|
}); |
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
my $flags = $p{flags}; |
174
|
|
|
|
|
|
|
|
175
|
0
|
0
|
|
|
|
|
if ($p{special}) { |
176
|
0
|
|
|
|
|
|
return @{$p{special}}; |
|
0
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
|
my $args = { %{$p{args}} }; |
|
0
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
|
my $test = !!$p{flags}->{if}; |
182
|
0
|
|
|
|
|
|
my @children; |
183
|
0
|
0
|
|
|
|
|
if ($p{flags}->{eq}) { |
184
|
0
|
|
|
|
|
|
$test++; |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
0
|
0
|
|
|
|
|
if ($test) { # This is only a test of the Entry |
188
|
0
|
|
|
|
|
|
@children = @{$p{children}}; |
|
0
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
} else { |
190
|
0
|
|
|
|
|
|
@children = $self->expand_content(@{$p{children}}); |
|
0
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
0
|
|
|
|
|
|
@children = $self->children(context => $p{context}, children => \@children); |
194
|
|
|
|
|
|
|
|
195
|
0
|
0
|
|
|
|
|
if ($self->remove) { |
196
|
0
|
|
|
|
|
|
return (); |
197
|
|
|
|
|
|
|
} |
198
|
0
|
0
|
0
|
|
|
|
if ($self->remove_self || $flags->{rs}) { |
199
|
|
|
|
|
|
|
return ( |
200
|
0
|
|
|
|
|
|
@children, |
201
|
|
|
|
|
|
|
); |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
0
|
|
|
|
|
|
my $tag = $p{tag}; |
205
|
|
|
|
|
|
|
#die Dumper \@children if $p{tag} eq 'input' and $p{args}{name} eq 'test2'; |
206
|
|
|
|
|
|
|
|
207
|
0
|
|
|
|
|
|
my @ret; |
208
|
0
|
0
|
0
|
|
|
|
if ($special_tag{$tag} || @children) { |
209
|
0
|
|
|
|
|
|
@ret = ('<' . $tag . $self->exp_args(%$args) . '>', |
210
|
|
|
|
|
|
|
@children, |
211
|
|
|
|
|
|
|
'' . $tag . '>'); |
212
|
|
|
|
|
|
|
} else { |
213
|
0
|
|
|
|
|
|
@ret = ('<' . $tag . $self->exp_args(%$args) . '/>'); |
214
|
|
|
|
|
|
|
} |
215
|
0
|
|
|
|
|
|
return @ret; |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub set_id_count |
219
|
|
|
|
|
|
|
{ |
220
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
221
|
0
|
|
|
|
|
|
my $data = shift; |
222
|
|
|
|
|
|
|
|
223
|
0
|
|
|
|
|
|
$self->{id_count} = $data; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub id_count |
227
|
|
|
|
|
|
|
{ |
228
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
229
|
0
|
|
|
|
|
|
my $ret; |
230
|
0
|
0
|
|
|
|
|
if ($self->in_loop) { |
231
|
0
|
|
|
|
|
|
$ret = $self->{id_count}; |
232
|
|
|
|
|
|
|
} |
233
|
0
|
|
|
|
|
|
return $ret; |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
sub in_loop |
237
|
|
|
|
|
|
|
{ |
238
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
239
|
|
|
|
|
|
|
|
240
|
0
|
|
|
|
|
|
defined $self->{id_count}; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub form |
244
|
|
|
|
|
|
|
{ |
245
|
0
|
|
|
0
|
1
|
|
undef; |
246
|
|
|
|
|
|
|
} |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
sub required |
249
|
|
|
|
|
|
|
{ |
250
|
0
|
|
|
0
|
1
|
|
shift; |
251
|
|
|
|
|
|
|
|
252
|
0
|
|
|
|
|
|
@_; |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub set_tag |
256
|
|
|
|
|
|
|
{ |
257
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
258
|
0
|
|
|
|
|
|
my %p = @_; |
259
|
|
|
|
|
|
|
|
260
|
0
|
|
|
|
|
|
$self->{tag} = $p{tag}; |
261
|
|
|
|
|
|
|
|
262
|
0
|
0
|
|
|
|
|
$self->{_args} = { |
263
|
0
|
0
|
|
|
|
|
%{$p{args} || {}}, |
264
|
0
|
|
|
|
|
|
%{$self->{args} || {}} |
265
|
|
|
|
|
|
|
}; |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
package |
269
|
|
|
|
|
|
|
XHTML::Instrumented::Control::Dummy; |
270
|
|
|
|
|
|
|
|
271
|
3
|
|
|
3
|
|
78
|
use base 'XHTML::Instrumented::Control'; |
|
3
|
|
|
|
|
32
|
|
|
3
|
|
|
|
|
535
|
|
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
sub if |
274
|
|
|
|
|
|
|
{ |
275
|
0
|
|
|
0
|
|
|
0; |
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
sub is_dummy |
279
|
|
|
|
|
|
|
{ |
280
|
0
|
|
|
0
|
|
|
1; |
281
|
|
|
|
|
|
|
} |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
1; |
284
|
|
|
|
|
|
|
__END__ |