line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Processor::Field::USPhone; |
2
|
|
|
|
|
|
|
$Form::Processor::Field::USPhone::VERSION = '1.162360'; |
3
|
1
|
|
|
1
|
|
885
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
3
|
use base 'Form::Processor::Field::Text'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
354
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub validate { |
9
|
3
|
|
|
3
|
1
|
3
|
my $self = shift; |
10
|
|
|
|
|
|
|
|
11
|
3
|
50
|
|
|
|
6
|
return unless $self->SUPER::validate; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
|
|
3
|
my $input = $self->input; |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
|
|
9
|
$input =~ s/\D//g; |
16
|
|
|
|
|
|
|
|
17
|
3
|
50
|
|
|
|
4
|
return $self->add_error( 'Phone Number must be 10 digits, including area code' ) |
18
|
|
|
|
|
|
|
unless length $input == 10; |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
|
|
8
|
return 1; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# ABSTRACT: Validate that the input looks like a US phone number |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |