line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::ValidOp::Check::demographics; |
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw/ CGI::ValidOp::Check /; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
461
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# sub default { |
8
|
|
|
|
|
|
|
# ( |
9
|
|
|
|
|
|
|
# qr/^on$/i, |
10
|
|
|
|
|
|
|
# q#Parameter $label must be a US state name.#, |
11
|
|
|
|
|
|
|
# ) |
12
|
|
|
|
|
|
|
# } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub us_state2 { |
15
|
125
|
|
|
125
|
1
|
267
|
my $self = shift; |
16
|
|
|
|
|
|
|
sub { |
17
|
125
|
|
|
125
|
|
317
|
my $value = shift; |
18
|
125
|
100
|
|
|
|
502
|
return $self->pass unless defined $value; |
19
|
124
|
|
|
|
|
246
|
my $errmsg = q/$label must be the 2-letter abbreviation for a US state name./; |
20
|
124
|
100
|
|
|
|
1150
|
return $self->fail( $errmsg ) unless $value =~ /^\w{2}$/; |
21
|
122
|
100
|
|
|
|
1776
|
return $self->pass( $1 ) if $value =~ |
22
|
|
|
|
|
|
|
qr/^(al|ak|as|az|ar|ca|co|ct|de|dc|fm|fl|ga|gu|hi|id|il|in|ia|ks|ky|la|me|mh|md|ma|mi|mn|ms|mo|mt|ne|nv|nh|nj|nm|ny|nc|nd|mp|oh|ok|or|pw|pa|pr|ri|sc|sd|tn|tx|ut|vt|vi|va|wa|wv|wi|wy)$/i; |
23
|
4
|
|
|
|
|
17
|
$self->fail( $errmsg ); |
24
|
|
|
|
|
|
|
} |
25
|
125
|
|
|
|
|
785
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub us_ssn { |
28
|
12
|
|
|
12
|
1
|
21
|
my $self = shift; |
29
|
|
|
|
|
|
|
sub { |
30
|
12
|
|
|
12
|
|
29
|
my( $value, $constraint ) = @_; |
31
|
12
|
50
|
|
|
|
39
|
return $self->pass unless defined $value; |
32
|
12
|
100
|
|
|
|
64
|
if( $value =~ /(^\d{3}-?\d{2}-?\d{4}$)/ ) { |
33
|
8
|
|
|
|
|
22
|
my $ssn = $1; |
34
|
8
|
100
|
66
|
|
|
36
|
$ssn =~ s/-//g if $constraint and $constraint eq 'integer'; |
35
|
8
|
|
|
|
|
28
|
return $self->pass( $ssn ); |
36
|
|
|
|
|
|
|
} |
37
|
4
|
|
|
|
|
19
|
return $self->fail( q/$label must be a number like "123-45-6789"./); |
38
|
|
|
|
|
|
|
} |
39
|
12
|
|
|
|
|
73
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |