line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
3
|
|
|
3
|
|
84667
|
|
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
71
|
|
4
|
|
|
|
|
|
|
use Carp(); |
5
|
3
|
|
|
3
|
|
12
|
|
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
49
|
|
6
|
|
|
|
|
|
|
use Rose::HTML::Object::Errors qw(:string); |
7
|
3
|
|
|
3
|
|
350
|
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
19
|
|
8
|
|
|
|
|
|
|
use base 'Rose::HTML::Form::Field'; |
9
|
3
|
|
|
3
|
|
18
|
|
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1265
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.606'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use Rose::Object::MakeMethods::Generic |
13
|
|
|
|
|
|
|
( |
14
|
|
|
|
|
|
|
scalar => 'maxlength', |
15
|
3
|
|
|
|
|
19
|
); |
16
|
3
|
|
|
3
|
|
26
|
|
|
3
|
|
|
|
|
6
|
|
17
|
|
|
|
|
|
|
__PACKAGE__->add_valid_html_attrs |
18
|
|
|
|
|
|
|
( |
19
|
|
|
|
|
|
|
'rows', # NUMBER #REQUIRED |
20
|
|
|
|
|
|
|
'cols', # NUMBER #REQUIRED |
21
|
|
|
|
|
|
|
'disabled', # (disabled) #IMPLIED -- unavailable in this context -- |
22
|
|
|
|
|
|
|
'readonly', # (readonly) #IMPLIED |
23
|
|
|
|
|
|
|
'onselect', # %Script; #IMPLIED -- some text was selected -- |
24
|
|
|
|
|
|
|
'onchange', # %Script; #IMPLIED -- the element value was changed -- |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__PACKAGE__->add_required_html_attrs( |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
rows => 6, |
30
|
|
|
|
|
|
|
cols => 50, |
31
|
|
|
|
|
|
|
}); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__PACKAGE__->add_boolean_html_attrs |
34
|
|
|
|
|
|
|
( |
35
|
|
|
|
|
|
|
'disabled', |
36
|
|
|
|
|
|
|
'readonly', |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
0
|
1
|
0
|
|
41
|
25
|
|
|
25
|
1
|
102
|
{ |
42
|
14
|
|
|
14
|
1
|
60
|
my($self) = shift; |
43
|
|
|
|
|
|
|
return $self->input_value(@_) if(@_); |
44
|
1
|
|
|
1
|
1
|
8
|
return $self->output_value; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
{ |
48
|
1
|
|
|
1
|
1
|
3
|
my($self) = shift; |
49
|
1
|
50
|
|
|
|
4
|
|
50
|
0
|
|
|
|
|
0
|
if(@_) |
51
|
|
|
|
|
|
|
{ |
52
|
|
|
|
|
|
|
$self->SUPER::input_value(@_); |
53
|
|
|
|
|
|
|
$self->children(defined $_[0] ? $self->output_value : ''); |
54
|
|
|
|
|
|
|
} |
55
|
48
|
|
|
48
|
1
|
68
|
|
56
|
|
|
|
|
|
|
# XXX: Intentional double set in order to maintain error() |
57
|
48
|
100
|
|
|
|
88
|
# XXX: produced by a possible call to inflate_value() |
58
|
|
|
|
|
|
|
return $self->SUPER::input_value(@_); |
59
|
17
|
|
|
|
|
53
|
} |
60
|
17
|
100
|
|
|
|
59
|
|
61
|
|
|
|
|
|
|
{ |
62
|
|
|
|
|
|
|
my($self) = shift; |
63
|
|
|
|
|
|
|
$self->delete_children; |
64
|
|
|
|
|
|
|
return $self->SUPER::clear(@_); |
65
|
48
|
|
|
|
|
112
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
{ |
68
|
|
|
|
|
|
|
my($self) = shift; |
69
|
|
|
|
|
|
|
$self->SUPER::reset(@_); |
70
|
2
|
|
|
2
|
1
|
6
|
$self->children($self->output_value); |
71
|
2
|
|
|
|
|
10
|
} |
72
|
2
|
|
|
|
|
11
|
|
73
|
|
|
|
|
|
|
{ |
74
|
|
|
|
|
|
|
my($self) = shift; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
if(@_) |
77
|
2
|
|
|
2
|
1
|
7
|
{ |
78
|
2
|
|
|
|
|
14
|
local $_ = shift; |
79
|
2
|
|
|
|
|
6
|
|
80
|
|
|
|
|
|
|
if(my($cols, $rows) = /^(\d+)x(\d+)$/) |
81
|
|
|
|
|
|
|
{ |
82
|
|
|
|
|
|
|
$self->cols($cols); |
83
|
|
|
|
|
|
|
$self->rows($rows); |
84
|
4
|
|
|
4
|
1
|
432
|
return $cols . 'x' . $rows; |
85
|
|
|
|
|
|
|
} |
86
|
4
|
100
|
|
|
|
10
|
else |
87
|
|
|
|
|
|
|
{ |
88
|
2
|
|
|
|
|
4
|
Carp::croak "Invalid size argument '$_' is not in the form COLSxROWS"; |
89
|
|
|
|
|
|
|
} |
90
|
2
|
100
|
|
|
|
11
|
} |
91
|
|
|
|
|
|
|
|
92
|
1
|
|
|
|
|
5
|
return $self->cols . 'x' . $self->rows; |
93
|
1
|
|
|
|
|
4
|
} |
94
|
1
|
|
|
|
|
5
|
|
95
|
|
|
|
|
|
|
{ |
96
|
|
|
|
|
|
|
my($self) = shift; |
97
|
|
|
|
|
|
|
|
98
|
1
|
|
|
|
|
165
|
my $ok = $self->SUPER::validate(@_); |
99
|
|
|
|
|
|
|
return $ok unless($ok); |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
my $value = $self->input_value; |
102
|
2
|
|
|
|
|
4
|
return 1 unless(defined $value && length $value); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
my $maxlength = $self->maxlength; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
my $name = sub { $self->label || $self->name }; |
107
|
4
|
|
|
4
|
1
|
10
|
|
108
|
|
|
|
|
|
|
if(defined $maxlength && length($value) > $maxlength) |
109
|
4
|
|
|
|
|
17
|
{ |
110
|
4
|
100
|
|
|
|
20
|
$self->add_error_id(STRING_OVERFLOW, { label => $name, maxlength => $maxlength }); |
111
|
|
|
|
|
|
|
return 0; |
112
|
2
|
|
|
|
|
6
|
} |
113
|
2
|
50
|
33
|
|
|
19
|
|
114
|
|
|
|
|
|
|
return 1; |
115
|
2
|
|
|
|
|
12
|
} |
116
|
|
|
|
|
|
|
1; |
117
|
2
|
0
|
|
0
|
|
10
|
|
|
0
|
|
|
|
|
0
|
|
118
|
|
|
|
|
|
|
|
119
|
2
|
100
|
66
|
|
|
19
|
=head1 NAME |
120
|
|
|
|
|
|
|
|
121
|
1
|
|
|
|
|
8
|
Rose::HTML::Form::Field::TextArea - Object representation of a multi-line text field in an HTML form. |
122
|
1
|
|
|
|
|
6
|
|
123
|
|
|
|
|
|
|
=head1 SYNOPSIS |
124
|
|
|
|
|
|
|
|
125
|
1
|
|
|
|
|
5
|
$field = |
126
|
|
|
|
|
|
|
Rose::HTML::Form::Field::TextArea->new( |
127
|
|
|
|
|
|
|
label => 'Comments', |
128
|
|
|
|
|
|
|
name => 'comments', |
129
|
|
|
|
|
|
|
rows => 2, |
130
|
|
|
|
|
|
|
cols => 50); |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
$comments = $field->internal_value; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
print $field->html; |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
... |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 DESCRIPTION |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
L<Rose::HTML::Form::Field::TextArea> is an object representation of a multi-line text field 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
|
|
|
|
|
|
|
accesskey |
149
|
|
|
|
|
|
|
class |
150
|
|
|
|
|
|
|
cols |
151
|
|
|
|
|
|
|
dir |
152
|
|
|
|
|
|
|
disabled |
153
|
|
|
|
|
|
|
id |
154
|
|
|
|
|
|
|
lang |
155
|
|
|
|
|
|
|
name |
156
|
|
|
|
|
|
|
onblur |
157
|
|
|
|
|
|
|
onchange |
158
|
|
|
|
|
|
|
onclick |
159
|
|
|
|
|
|
|
ondblclick |
160
|
|
|
|
|
|
|
onfocus |
161
|
|
|
|
|
|
|
onkeydown |
162
|
|
|
|
|
|
|
onkeypress |
163
|
|
|
|
|
|
|
onkeyup |
164
|
|
|
|
|
|
|
onmousedown |
165
|
|
|
|
|
|
|
onmousemove |
166
|
|
|
|
|
|
|
onmouseout |
167
|
|
|
|
|
|
|
onmouseover |
168
|
|
|
|
|
|
|
onmouseup |
169
|
|
|
|
|
|
|
onselect |
170
|
|
|
|
|
|
|
readonly |
171
|
|
|
|
|
|
|
rows |
172
|
|
|
|
|
|
|
style |
173
|
|
|
|
|
|
|
tabindex |
174
|
|
|
|
|
|
|
title |
175
|
|
|
|
|
|
|
value |
176
|
|
|
|
|
|
|
xml:lang |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Required attributes (default values in parentheses): |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
cols (50) |
181
|
|
|
|
|
|
|
rows (6) |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Boolean attributes: |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
checked |
186
|
|
|
|
|
|
|
disabled |
187
|
|
|
|
|
|
|
readonly |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=over 4 |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=item B<new PARAMS> |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Constructs a new L<Rose::HTML::Form::Field::TextArea> object based on PARAMS, where PARAMS are name/value pairs. Any object method is a valid parameter name. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=back |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head1 OBJECT METHODS |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=over 4 |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=item B<contents [TEXT]> |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Get or set the contents of the text area. If a TEXT argument is present, it is passed to L<input_value()|Rose::HTML::Form::Field/input_value> and the return value of that method call is then returned. Otherwise, L<output_value()|Rose::HTML::Form::Field/output_value> is called with no arguments. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=item B<maxlength [INT]> |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Get or set the maximum length of the input value. Note that this is not an HTML attribute; this limit is enforced by the L<validate|Rose::HTML::Form::Field/validate> method, not by the web browser. |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=item B<size [COLSxROWS]> |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Get or set the number of columns and rows (C<cols> and C<rows>) in the text area in the form of a string "COLSxROWS". For example, "40x3" means 40 columns and 3 rows. If the size argument is not in the correct format, a fatal error will occur. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=item B<value [TEXT]> |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
Simply calls L<input_value|Rose::HTML::Form::Field/input_value>, passing all arguments. |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=back |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head1 AUTHOR |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
John C. Siracusa (siracusa@gmail.com) |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=head1 LICENSE |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
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. |