line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Processor::Field::PosInteger; |
2
|
|
|
|
|
|
|
$Form::Processor::Field::PosInteger::VERSION = '1.162360'; |
3
|
1
|
|
|
1
|
|
848
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
5
|
use base 'Form::Processor::Field::Integer'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
378
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub validate { |
10
|
6
|
|
|
6
|
1
|
6
|
my $self = shift; |
11
|
|
|
|
|
|
|
|
12
|
6
|
100
|
|
|
|
12
|
return unless $self->SUPER::validate; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# remove plus sign. |
15
|
4
|
|
|
|
|
5
|
my $value = $self->input; |
16
|
4
|
50
|
|
|
|
6
|
if ( $value =~ s/^\+// ) { |
17
|
0
|
|
|
|
|
0
|
$self->input( $value ); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
4
|
100
|
|
|
|
10
|
return $self->add_error( 'Value must be a positive integer' ) |
22
|
|
|
|
|
|
|
unless $self->input >= 0; |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
|
|
6
|
return 1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# ABSTRACT: Validates input is a postive integer |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |