line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::SuperForm::Field; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1959
|
use overload; |
|
1
|
|
|
|
|
1385
|
|
|
1
|
|
|
|
|
9
|
|
4
|
1
|
|
|
1
|
|
64
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
49
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6670
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our %accessors = map { $_ => 1 } qw(multiple selectable value default form disabled readonly sticky fallback well_formed values_as_labels); |
9
|
|
|
|
|
|
|
our %mutators; |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
0
|
1
|
|
sub prepare {} |
12
|
0
|
|
|
0
|
1
|
|
sub init {} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $form; |
18
|
0
|
0
|
|
|
|
|
if(UNIVERSAL::isa($_[0], "HTML::SuperForm")) { |
19
|
0
|
|
|
|
|
|
$form = shift; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $config = {}; |
23
|
0
|
0
|
|
|
|
|
if(ref($_[0]) eq "HASH") { |
24
|
0
|
|
|
|
|
|
$config = shift; |
25
|
|
|
|
|
|
|
} else { |
26
|
0
|
|
|
|
|
|
%$config = @_; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
overload::OVERLOAD($class, '""' => \&{$class . "::to_html"}); |
|
0
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $self = { |
32
|
|
|
|
|
|
|
_other_info => {} |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
$self->{_form} = $form; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
bless $self, $class; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
$self->init($config); |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
$self->{_readonly} = delete $config->{readonly}; |
42
|
0
|
|
|
|
|
|
$self->{_disabled} = delete $config->{disabled}; |
43
|
0
|
|
|
|
|
|
$self->{_multiple} = delete $config->{multiple}; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
0
|
|
|
|
my $labels = delete $config->{labels} || {}; |
46
|
0
|
|
0
|
|
|
|
my $all_values = delete $config->{values} || [ keys %$labels ]; |
47
|
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
if(ref($all_values) ne "ARRAY") { |
49
|
0
|
|
|
|
|
|
$all_values = [ $all_values ]; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
0
|
|
|
|
if( defined($config->{value}) && @$all_values == 0) { |
53
|
0
|
|
|
|
|
|
push(@{$all_values}, $config->{value}); |
|
0
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
0
|
|
|
|
|
if(exists($config->{label})) { |
57
|
0
|
|
|
|
|
|
$self->{_label} = delete $config->{label}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$self->{_labels} = $labels; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
$self->{_all_values} = $all_values; |
63
|
0
|
|
|
|
|
|
my %all_values_hash = map { $_ => 1 } @$all_values; |
|
0
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $default; |
66
|
0
|
0
|
|
|
|
|
if(exists($config->{default})) { |
67
|
0
|
|
|
|
|
|
$default = delete $config->{default}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
if(exists($config->{defaults})) { |
71
|
0
|
|
|
|
|
|
$default = delete $config->{defaults}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
$self->{_default} = $default; |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
0
|
|
|
|
if(ref($self->{_default}) eq "ARRAY" && scalar(@{$self->{_default}}) == 0) { |
|
0
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
$self->{_default} = undef; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
|
if(UNIVERSAL::isa($form, "HTML::SuperForm")) { |
81
|
0
|
|
|
|
|
|
$self->{_fallback} = $self->{_form}->fallback; |
82
|
0
|
|
|
|
|
|
$self->{_sticky} = $self->{_form}->sticky; |
83
|
0
|
|
|
|
|
|
$self->{_well_formed} = $self->{_form}->well_formed; |
84
|
0
|
|
|
|
|
|
$self->{_values_as_labels} = $self->{_form}->values_as_labels; |
85
|
|
|
|
|
|
|
} else { |
86
|
0
|
|
|
|
|
|
$self->{_fallback} = 0; |
87
|
0
|
|
|
|
|
|
$self->{_sticky} = 0; |
88
|
0
|
|
|
|
|
|
$self->{_well_formed} = 1; |
89
|
0
|
|
|
|
|
|
$self->{_values_as_labels} = 1; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
0
|
0
|
|
|
|
|
if($self->{_disabled}) { |
93
|
0
|
|
|
|
|
|
$self->{_sticky} = 0; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
for my $key (qw(fallback sticky well_formed values_as_labels)) { |
97
|
0
|
0
|
|
|
|
|
if(exists($config->{$key})) { |
98
|
0
|
|
|
|
|
|
$self->{'_' . $key} = delete $config->{$key}; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
0
|
0
|
|
|
|
|
if(exists($config->{value_as_label})) { |
103
|
0
|
|
|
|
|
|
$self->{_values_as_labels} = delete $config->{value_as_label}; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
$self->{_attributes} = $config; |
107
|
|
|
|
|
|
|
|
108
|
0
|
0
|
0
|
|
|
|
if($self->{_multiple} || scalar(@{$self->{_all_values}}) > 0) { |
|
0
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
$self->{_selectable} = 1; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
0
|
0
|
0
|
|
|
|
if( UNIVERSAL::isa($form, "HTML::SuperForm") && |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
113
|
|
|
|
|
|
|
$self->sticky() && |
114
|
|
|
|
|
|
|
(exists($config->{name}) && |
115
|
|
|
|
|
|
|
$form->exists_param($config->{name}) || !$self->fallback) |
116
|
|
|
|
|
|
|
) { |
117
|
0
|
|
|
|
|
|
$self->{_value} = $form->param($config->{name}); |
118
|
|
|
|
|
|
|
} else { |
119
|
0
|
|
|
|
|
|
$self->{_value} = $self->default; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
0
|
0
|
0
|
|
|
|
if(!$self->selectable && ref($self->{_value}) eq "ARRAY") { |
123
|
0
|
|
|
|
|
|
my $i = $self->{_form}->no_of_fields($self->name); |
124
|
0
|
|
|
|
|
|
$self->{_value} = $self->{_value}[$i]; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
$self->{_value} = $self->escape_html($self->{_value}); |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
my @select = (); |
130
|
0
|
0
|
|
|
|
|
if(ref($self->{_value}) eq "ARRAY") { |
131
|
0
|
|
|
|
|
|
@select = @{$self->{_value}}; |
|
0
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
} else { |
133
|
0
|
0
|
|
|
|
|
if(defined($self->{_value})) { |
134
|
0
|
|
|
|
|
|
@select = ( $self->{_value} ); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
for my $s (@select) { |
139
|
0
|
0
|
|
|
|
|
$self->{_selected}{$s} = 1 if $all_values_hash{$s}; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
$self->prepare(); |
143
|
0
|
|
|
|
|
|
$self->update_form(); |
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
return $self; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub escape_html { |
149
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
150
|
0
|
|
|
|
|
|
my $arg = shift; |
151
|
|
|
|
|
|
|
|
152
|
0
|
0
|
|
|
|
|
if(ref($arg) eq "ARRAY") { |
153
|
0
|
|
|
|
|
|
my $strings = $arg; |
154
|
0
|
|
|
|
|
|
$arg = []; |
155
|
0
|
|
|
|
|
|
for(0..$#$strings) { |
156
|
0
|
|
|
|
|
|
$arg->[$_] = $strings->[$_]; |
157
|
0
|
|
|
|
|
|
$arg->[$_] =~ s/(["&<>])/'' . ord($1) . ';'/ge; |
|
0
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
} else { |
160
|
0
|
|
|
|
|
|
$arg =~ s/(["&<>])/'' . ord($1) . ';'/ge; |
|
0
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
|
return $arg; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub name { |
167
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
168
|
0
|
|
|
|
|
|
return $self->{_attributes}{name}; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub set { |
172
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
173
|
|
|
|
|
|
|
|
174
|
0
|
|
|
|
|
|
my %hash; |
175
|
|
|
|
|
|
|
|
176
|
0
|
0
|
|
|
|
|
if(ref($_[0]) eq "HASH") { |
177
|
0
|
|
|
|
|
|
%hash = %{ shift() }; |
|
0
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
} else { |
179
|
0
|
|
|
|
|
|
%hash = @_; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
|
$self->{_other_info} = { |
183
|
0
|
|
|
|
|
|
%{$self->{_other_info}}, |
184
|
|
|
|
|
|
|
%hash, |
185
|
|
|
|
|
|
|
}; |
186
|
|
|
|
|
|
|
|
187
|
0
|
|
|
|
|
|
return; |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub get { |
191
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
192
|
|
|
|
|
|
|
|
193
|
0
|
|
|
|
|
|
my @return; |
194
|
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
for my $key (@_) { |
196
|
0
|
0
|
|
|
|
|
if(exists($self->{_other_info}{$key})) { |
197
|
0
|
|
|
|
|
|
push(@return, $self->{_other_info}{$key}); |
198
|
|
|
|
|
|
|
} else { |
199
|
0
|
|
|
|
|
|
carp "WARNING: nothing stored under key $key"; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
0
|
0
|
|
|
|
|
return wantarray ? @return : |
|
|
0
|
|
|
|
|
|
204
|
|
|
|
|
|
|
scalar(@return) == 1 ? $return[0] : \@return; |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
sub label { |
208
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
209
|
0
|
|
|
|
|
|
my $key = shift; |
210
|
|
|
|
|
|
|
|
211
|
0
|
0
|
|
|
|
|
if(defined($key)) { |
212
|
0
|
|
|
|
|
|
my $label; |
213
|
0
|
0
|
|
|
|
|
if(exists($self->{_labels}{$key})) { |
|
|
0
|
|
|
|
|
|
214
|
0
|
|
|
|
|
|
$label = $self->{_labels}{$key}; |
215
|
|
|
|
|
|
|
} elsif($self->values_as_labels) { |
216
|
0
|
|
|
|
|
|
$label = $key; |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
|
return $label; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
0
|
0
|
0
|
|
|
|
if(exists($self->{_label})) { |
|
0
|
0
|
0
|
|
|
|
|
223
|
0
|
|
|
|
|
|
return $self->{_label}; |
224
|
|
|
|
|
|
|
} elsif($self->selectable && $self->values_as_labels && scalar(@{$self->{_all_values}}) == 1) { |
225
|
0
|
|
|
|
|
|
return @{$self->{_all_values}}[0]; |
|
0
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
0
|
|
|
|
|
|
return; |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub has_label { |
232
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
233
|
|
|
|
|
|
|
|
234
|
0
|
0
|
0
|
|
|
|
if(exists($self->{_label}) || ($self->selectable && $self->values_as_labels && scalar(@{$self->{_all_values}}) == 1)) { |
|
0
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
235
|
0
|
|
|
|
|
|
return 1; |
236
|
|
|
|
|
|
|
} |
237
|
|
|
|
|
|
|
|
238
|
0
|
|
|
|
|
|
return; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub get_attribute { |
242
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
243
|
0
|
|
|
|
|
|
my $key = shift; |
244
|
|
|
|
|
|
|
|
245
|
0
|
|
|
|
|
|
return $self->{_attributes}{$key}; |
246
|
|
|
|
|
|
|
} |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
sub selected { |
249
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
250
|
0
|
|
|
|
|
|
my $key = shift; |
251
|
|
|
|
|
|
|
|
252
|
0
|
0
|
|
|
|
|
if(ref($key) eq "ARRAY") { |
253
|
0
|
|
|
|
|
|
for my $k (@$key) { |
254
|
0
|
0
|
|
|
|
|
if($self->{_selected}{$k}) { |
255
|
0
|
|
|
|
|
|
return 1; |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
} |
258
|
0
|
|
|
|
|
|
return 0; |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
|
261
|
0
|
|
|
|
|
|
return $self->{_selected}{$key}; |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub selected_str { |
265
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
266
|
0
|
|
|
|
|
|
my $key = shift; |
267
|
0
|
0
|
|
|
|
|
if($self->well_formed) { |
268
|
0
|
0
|
|
|
|
|
return $self->selected($key) ? ' selected="selected"' : ''; |
269
|
|
|
|
|
|
|
} |
270
|
0
|
0
|
|
|
|
|
return $self->selected($key) ? ' selected' : ''; |
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
sub checked_str { |
274
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
275
|
0
|
|
|
|
|
|
my $key = shift; |
276
|
0
|
0
|
|
|
|
|
if($self->well_formed) { |
277
|
0
|
0
|
|
|
|
|
return $self->selected($key) ? ' checked="checked"' : ''; |
278
|
|
|
|
|
|
|
} |
279
|
0
|
0
|
|
|
|
|
return $self->selected($key) ? ' checked' : ''; |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
sub multiple_str { |
283
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
284
|
|
|
|
|
|
|
|
285
|
0
|
0
|
|
|
|
|
if($self->well_formed) { |
286
|
0
|
0
|
|
|
|
|
return $self->multiple ? ' multiple="' . $self->multiple . '"' : ''; |
287
|
|
|
|
|
|
|
} |
288
|
0
|
0
|
|
|
|
|
return $self->multiple ? ' multiple' : ''; |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
sub readonly_str { |
292
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
293
|
|
|
|
|
|
|
|
294
|
0
|
0
|
|
|
|
|
if($self->well_formed) { |
295
|
0
|
0
|
|
|
|
|
return $self->readonly ? ' readonly="' . $self->readonly . '"' : ''; |
296
|
|
|
|
|
|
|
} |
297
|
0
|
0
|
|
|
|
|
return $self->readonly ? ' readonly' : ''; |
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
sub disabled_str { |
301
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
302
|
|
|
|
|
|
|
|
303
|
0
|
0
|
|
|
|
|
if($self->well_formed) { |
304
|
0
|
0
|
|
|
|
|
return $self->disabled ? ' disabled="' . $self->disabled . '"' : ''; |
305
|
|
|
|
|
|
|
} |
306
|
0
|
0
|
|
|
|
|
return $self->disabled ? ' disabled' : ''; |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
sub update_form { |
310
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
311
|
|
|
|
|
|
|
|
312
|
0
|
0
|
|
|
|
|
return unless $self->name(); |
313
|
0
|
0
|
|
|
|
|
return unless UNIVERSAL::isa($self->form, "HTML::SuperForm"); |
314
|
|
|
|
|
|
|
|
315
|
0
|
0
|
0
|
|
|
|
if(defined($self->default) || !$self->selectable) { |
316
|
0
|
|
|
|
|
|
$self->form->add_default($self->name() => $self->default); |
317
|
|
|
|
|
|
|
} else { |
318
|
0
|
|
|
|
|
|
$self->form->set_default($self->name() => undef); |
319
|
|
|
|
|
|
|
} |
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
sub attribute_str { |
323
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
324
|
|
|
|
|
|
|
|
325
|
0
|
|
|
|
|
|
return " " . join(' ', map { qq|$_="$self->{_attributes}{$_}"| } |
|
0
|
|
|
|
|
|
|
326
|
0
|
|
|
|
|
|
keys %{$self->{_attributes}}); |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
sub values { |
330
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
331
|
|
|
|
|
|
|
|
332
|
0
|
|
|
|
|
|
return $self->{_all_values}; |
333
|
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
sub AUTOLOAD { |
336
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
337
|
|
|
|
|
|
|
|
338
|
0
|
|
|
|
|
|
my ($key) = ${*AUTOLOAD} =~ /::([^:]*)$/; |
|
0
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
{ |
341
|
1
|
|
|
1
|
|
19
|
no strict "refs"; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
472
|
|
|
0
|
|
|
|
|
|
|
342
|
0
|
0
|
|
|
|
|
if(exists($mutators{$key})) { |
343
|
0
|
|
|
|
|
|
*{"HTML::SuperForm::Field::$key"} = sub { |
344
|
0
|
|
|
0
|
|
|
my $self = shift; |
345
|
0
|
|
|
|
|
|
my $val = shift; |
346
|
|
|
|
|
|
|
|
347
|
0
|
0
|
|
|
|
|
if(defined($val)) { |
348
|
0
|
|
|
|
|
|
$self->{'_' . $key} = $val; |
349
|
0
|
|
|
|
|
|
return; |
350
|
|
|
|
|
|
|
} |
351
|
|
|
|
|
|
|
|
352
|
0
|
|
|
|
|
|
return $self->{'_' . $key}; |
353
|
0
|
|
|
|
|
|
}; |
354
|
0
|
|
|
|
|
|
goto &{"HTML::SuperForm::Field::$key"}; |
|
0
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
} |
356
|
|
|
|
|
|
|
|
357
|
0
|
0
|
|
|
|
|
if(exists($accessors{$key})) { |
358
|
0
|
|
|
|
|
|
*{"HTML::SuperForm::Field::$key"} = sub { |
359
|
0
|
|
|
0
|
|
|
my $self = shift; |
360
|
|
|
|
|
|
|
|
361
|
0
|
|
|
|
|
|
return $self->{'_' . $key}; |
362
|
0
|
|
|
|
|
|
}; |
363
|
0
|
|
|
|
|
|
goto &{"HTML::SuperForm::Field::$key"}; |
|
0
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
|
366
|
0
|
0
|
|
|
|
|
if(exists($self->{_attributes}{$key})) { |
367
|
0
|
|
|
|
|
|
*{"HTML::SuperForm::Field::$key"} = sub { |
368
|
0
|
|
|
0
|
|
|
my $self = shift; |
369
|
0
|
|
|
|
|
|
return $self->{_attributes}{$key}; |
370
|
0
|
|
|
|
|
|
}; |
371
|
0
|
|
|
|
|
|
goto &{"HTML::SuperForm::Field::$key"}; |
|
0
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
} else { |
373
|
0
|
|
|
|
|
|
croak "ERROR: attribute $key doesn't exist"; |
374
|
|
|
|
|
|
|
} |
375
|
|
|
|
|
|
|
} |
376
|
|
|
|
|
|
|
|
377
|
0
|
|
|
|
|
|
return; |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
|
380
|
0
|
|
|
0
|
|
|
sub DESTROY {} |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
1; |
383
|
|
|
|
|
|
|
__END__ |