line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
5
|
|
|
5
|
|
85589
|
|
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
143
|
|
4
|
|
|
|
|
|
|
use Carp(); |
5
|
5
|
|
|
5
|
|
35
|
|
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
81
|
|
6
|
|
|
|
|
|
|
use base 'Rose::HTML::Form::Field::Input'; |
7
|
5
|
|
|
5
|
|
25
|
|
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
1012
|
|
8
|
|
|
|
|
|
|
use Rose::Object::MakeMethods::Generic |
9
|
|
|
|
|
|
|
( |
10
|
|
|
|
|
|
|
'boolean' => 'was_submitted', |
11
|
5
|
|
|
|
|
54
|
); |
12
|
5
|
|
|
5
|
|
31
|
|
|
5
|
|
|
|
|
14
|
|
13
|
|
|
|
|
|
|
use Rose::HTML::Object::MakeMethods::Localization |
14
|
|
|
|
|
|
|
( |
15
|
|
|
|
|
|
|
localized_message => |
16
|
5
|
|
|
|
|
68
|
[ |
17
|
|
|
|
|
|
|
qw(_value) |
18
|
|
|
|
|
|
|
], |
19
|
|
|
|
|
|
|
); |
20
|
5
|
|
|
5
|
|
690
|
|
|
5
|
|
|
|
|
19
|
|
21
|
|
|
|
|
|
|
__PACKAGE__->add_required_html_attrs( |
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
type => 'submit', |
24
|
|
|
|
|
|
|
name => '', |
25
|
|
|
|
|
|
|
}); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $VERSION = '0.616'; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
0
|
0
|
|
31
|
30
|
|
|
30
|
1
|
61
|
*xhtml_hidden_fields = \&html_hidden_fields; |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
0
|
1
|
0
|
|
34
|
0
|
0
|
|
0
|
1
|
0
|
|
35
|
|
|
|
|
|
|
{ |
36
|
|
|
|
|
|
|
my($self, $xhtml, %args) = @_; |
37
|
|
|
|
|
|
|
|
38
|
107
|
|
|
107
|
1
|
195
|
$args{'type'} = 'image'; |
39
|
1
|
|
|
1
|
1
|
4
|
|
40
|
|
|
|
|
|
|
my %old; |
41
|
1
|
|
|
1
|
1
|
6
|
|
42
|
1
|
|
|
1
|
1
|
4
|
while(my($k, $v) = each(%args)) |
43
|
|
|
|
|
|
|
{ |
44
|
|
|
|
|
|
|
if($self->html_attr_exists($k)) |
45
|
|
|
|
|
|
|
{ |
46
|
2
|
|
|
2
|
|
7
|
$old{$k} = $self->html_attr($k); |
47
|
|
|
|
|
|
|
} |
48
|
2
|
|
|
|
|
5
|
|
49
|
|
|
|
|
|
|
$self->html_attr($k => $v); |
50
|
2
|
|
|
|
|
3
|
} |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
8
|
Carp::croak("Missing src attribute") unless(length $self->html_attr('src')); |
53
|
|
|
|
|
|
|
|
54
|
6
|
50
|
|
|
|
18
|
my $ret = $xhtml ? $self->xhtml : $self->html; |
55
|
|
|
|
|
|
|
|
56
|
6
|
|
|
|
|
11
|
# Back out changes |
57
|
|
|
|
|
|
|
foreach my $attr (keys %args) |
58
|
|
|
|
|
|
|
{ |
59
|
6
|
|
|
|
|
13
|
if(exists $old{$attr}) |
60
|
|
|
|
|
|
|
{ |
61
|
|
|
|
|
|
|
$self->html_attr($attr => $old{$attr}); |
62
|
2
|
50
|
|
|
|
5
|
} |
63
|
|
|
|
|
|
|
else |
64
|
2
|
100
|
|
|
|
14
|
{ |
65
|
|
|
|
|
|
|
$self->delete_html_attr($attr); |
66
|
|
|
|
|
|
|
} |
67
|
2
|
|
|
|
|
7
|
} |
68
|
|
|
|
|
|
|
|
69
|
6
|
50
|
|
|
|
12
|
return $ret; |
70
|
|
|
|
|
|
|
} |
71
|
6
|
|
|
|
|
12
|
|
72
|
|
|
|
|
|
|
{ |
73
|
|
|
|
|
|
|
my($self) = shift; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
0
|
if(@_) |
76
|
|
|
|
|
|
|
{ |
77
|
|
|
|
|
|
|
$self->_value_message_id(@_); |
78
|
|
|
|
|
|
|
return $self->html_attr(value => $self->_value); |
79
|
2
|
|
|
|
|
11
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
return $self->_value_message_id; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
0
|
0
|
0
|
*value_id = \&value_message_id; |
85
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
0
|
{ |
87
|
|
|
|
|
|
|
my($self) = shift; |
88
|
0
|
|
|
|
|
0
|
|
89
|
0
|
|
|
|
|
0
|
if(@_) |
90
|
|
|
|
|
|
|
{ |
91
|
|
|
|
|
|
|
my $value = $self->_value(@_); |
92
|
0
|
|
|
|
|
0
|
return $self->SUPER::value($value); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
my $value = $self->html_attr('value'); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
unless(defined $value) |
98
|
|
|
|
|
|
|
{ |
99
|
40
|
|
|
40
|
1
|
162
|
return $self->html_attr(value => $self->_value); |
100
|
|
|
|
|
|
|
} |
101
|
40
|
100
|
|
|
|
82
|
|
102
|
|
|
|
|
|
|
return $value; |
103
|
17
|
|
|
|
|
52
|
} |
104
|
17
|
|
|
|
|
118
|
|
105
|
|
|
|
|
|
|
{ |
106
|
|
|
|
|
|
|
my ($self, $value) = @_; |
107
|
23
|
|
|
|
|
55
|
no warnings 'uninitialized'; |
108
|
|
|
|
|
|
|
$self->was_submitted($value eq $self->value); |
109
|
23
|
50
|
|
|
|
57
|
} |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
0
|
{ |
112
|
|
|
|
|
|
|
my ($self) = shift; |
113
|
|
|
|
|
|
|
return $self->value if($self->was_submitted); |
114
|
23
|
|
|
|
|
106
|
return undef; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |
118
|
|
|
|
|
|
|
|
119
|
22
|
|
|
22
|
1
|
48
|
|
120
|
5
|
|
|
5
|
|
2681
|
=head1 NAME |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
547
|
|
121
|
22
|
|
|
|
|
56
|
|
122
|
|
|
|
|
|
|
Rose::HTML::Form::Field::Submit - Object representation of a submit button in an HTML form. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 SYNOPSIS |
125
|
|
|
|
|
|
|
|
126
|
27
|
|
|
27
|
1
|
41
|
$field = |
127
|
27
|
100
|
|
|
|
59
|
Rose::HTML::Form::Field::Submit->new(name => 'run', |
128
|
26
|
|
|
|
|
133
|
value => 'Do it!'); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
print $field->html; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
# or... |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
print $field->image_html(src => 'images/run_button.gif'); |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
... |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 DESCRIPTION |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
L<Rose::HTML::Form::Field::Submit> is an object representation of a submit button in an HTML form. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This class inherits from, and follows the conventions of, L<Rose::HTML::Form::Field>. Inherited methods that are not overridden will not be documented a second time here. See the L<Rose::HTML::Form::Field> documentation for more information. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 HTML ATTRIBUTES |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Valid attributes: |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
accept |
149
|
|
|
|
|
|
|
accesskey |
150
|
|
|
|
|
|
|
alt |
151
|
|
|
|
|
|
|
checked |
152
|
|
|
|
|
|
|
class |
153
|
|
|
|
|
|
|
dir |
154
|
|
|
|
|
|
|
disabled |
155
|
|
|
|
|
|
|
id |
156
|
|
|
|
|
|
|
ismap |
157
|
|
|
|
|
|
|
lang |
158
|
|
|
|
|
|
|
maxlength |
159
|
|
|
|
|
|
|
name |
160
|
|
|
|
|
|
|
onblur |
161
|
|
|
|
|
|
|
onchange |
162
|
|
|
|
|
|
|
onclick |
163
|
|
|
|
|
|
|
ondblclick |
164
|
|
|
|
|
|
|
onfocus |
165
|
|
|
|
|
|
|
onkeydown |
166
|
|
|
|
|
|
|
onkeypress |
167
|
|
|
|
|
|
|
onkeyup |
168
|
|
|
|
|
|
|
onmousedown |
169
|
|
|
|
|
|
|
onmousemove |
170
|
|
|
|
|
|
|
onmouseout |
171
|
|
|
|
|
|
|
onmouseover |
172
|
|
|
|
|
|
|
onmouseup |
173
|
|
|
|
|
|
|
onselect |
174
|
|
|
|
|
|
|
readonly |
175
|
|
|
|
|
|
|
size |
176
|
|
|
|
|
|
|
src |
177
|
|
|
|
|
|
|
style |
178
|
|
|
|
|
|
|
tabindex |
179
|
|
|
|
|
|
|
title |
180
|
|
|
|
|
|
|
type |
181
|
|
|
|
|
|
|
usemap |
182
|
|
|
|
|
|
|
value |
183
|
|
|
|
|
|
|
xml:lang |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Required attributes (default values in parentheses): |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
name |
188
|
|
|
|
|
|
|
type (submit) |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Boolean attributes: |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
checked |
193
|
|
|
|
|
|
|
disabled |
194
|
|
|
|
|
|
|
ismap |
195
|
|
|
|
|
|
|
readonly |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=over 4 |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item B<new PARAMS> |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Constructs a new L<Rose::HTML::Form::Field::Submit> object based on PARAMS, where PARAMS are name/value pairs. Any object method is a valid parameter name. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=back |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head1 OBJECT METHODS |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=over 4 |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=item B<image_html [ARGS]> |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Returns the HTML serialization of the submit button using an image instead of a standard button widget (in other words, type="image"). ARGS is a list of HTML attribute name/value pairs which are temporarily set, then backed out before the method returns. (The type="image" change is also backed out.) |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
The "src" HTML attribute must be set (either in ARGS or from an existing value for that attribute) or a fatal error will occur. |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=item B<image_xhtml [ARGS]> |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Like L<image_html()|/image_html>, but serialized to XHTML instead. |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=item B<is_empty> |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Returns true. |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=item B<value [VALUE]> |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
Gets or sets the value of the "value" HTML attribute. |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=item B<was_submitted> |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Returns true if this submit button was pressed, false otherwise. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=back |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=head1 AUTHOR |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
John C. Siracusa (siracusa@gmail.com) |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head1 LICENSE |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |