line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Processor::Field::USZipcode; |
2
|
|
|
|
|
|
|
$Form::Processor::Field::USZipcode::VERSION = '1.162360'; |
3
|
1
|
|
|
1
|
|
913
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
3
|
use base 'Form::Processor::Field::Text'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
360
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub validate { |
10
|
4
|
|
|
4
|
1
|
4
|
my $self = shift; |
11
|
|
|
|
|
|
|
|
12
|
4
|
50
|
|
|
|
10
|
return unless $self->SUPER::validate; |
13
|
|
|
|
|
|
|
|
14
|
4
|
100
|
|
|
|
21
|
return $self->add_error( 'US Zip code must be 5 or 9 digits' ) |
15
|
|
|
|
|
|
|
unless $self->input =~ /^(\s*\d{5}(?:[-]\d{4})?\s*)$/; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
6
|
return 1; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# ABSTRACT: Checks that input looks like a US Zip. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |