line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Processor::Field::Text; |
2
|
|
|
|
|
|
|
$Form::Processor::Field::Text::VERSION = '1.162360'; |
3
|
15
|
|
|
15
|
|
888
|
use strict; |
|
15
|
|
|
|
|
18
|
|
|
15
|
|
|
|
|
327
|
|
4
|
15
|
|
|
15
|
|
45
|
use warnings; |
|
15
|
|
|
|
|
13
|
|
|
15
|
|
|
|
|
305
|
|
5
|
15
|
|
|
15
|
|
46
|
use base 'Form::Processor::Field'; |
|
15
|
|
|
|
|
15
|
|
|
15
|
|
|
|
|
6076
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Rose::Object::MakeMethods::Generic ( |
10
|
15
|
|
|
|
|
79
|
scalar => [ |
11
|
|
|
|
|
|
|
min_length => { interface => 'get_set_init' }, |
12
|
|
|
|
|
|
|
size => { interface => 'get_set_init' }, |
13
|
|
|
|
|
|
|
], |
14
|
15
|
|
|
15
|
|
84
|
); |
|
15
|
|
|
|
|
16
|
|
15
|
|
|
|
|
|
|
|
16
|
11
|
|
|
11
|
0
|
73
|
sub init_size { return 2500 } # new in .20 as a sanity check |
17
|
12
|
|
|
12
|
0
|
67
|
sub init_min_length { return 0 } |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
1
|
0
|
sub init_widget { return 'text' } |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub validate { |
24
|
61
|
|
|
61
|
1
|
71
|
my $field = shift; |
25
|
|
|
|
|
|
|
|
26
|
61
|
50
|
|
|
|
113
|
return unless $field->SUPER::validate; |
27
|
|
|
|
|
|
|
|
28
|
61
|
|
|
|
|
67
|
my $value = $field->input; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
61
|
50
|
|
|
|
118
|
if ( my $size = $field->size ) { |
32
|
|
|
|
|
|
|
|
33
|
61
|
|
|
|
|
187
|
my $value = $field->input; |
34
|
|
|
|
|
|
|
|
35
|
61
|
100
|
|
|
|
102
|
return $field->add_error( 'Please limit to [quant,_1,character]. You submitted [_2]', $size, length $value ) |
36
|
|
|
|
|
|
|
if length $value > $size; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Check for min length |
41
|
59
|
100
|
|
|
|
108
|
if ( my $size = $field->min_length ) { |
42
|
|
|
|
|
|
|
|
43
|
15
|
100
|
|
|
|
61
|
return $field->add_error( 'Input must be at least [quant,_1,character]. You submitted [_2]', $size, length $value ) |
44
|
|
|
|
|
|
|
if length $value < $size; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
56
|
|
|
|
|
215
|
return 1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# ABSTRACT: A simple text entry field |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |