line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: SSN Directive for Validation Class Field Definitions |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Validation::Class::Directive::SSN; |
4
|
|
|
|
|
|
|
|
5
|
108
|
|
|
108
|
|
68787
|
use strict; |
|
108
|
|
|
|
|
218
|
|
|
108
|
|
|
|
|
2799
|
|
6
|
108
|
|
|
108
|
|
554
|
use warnings; |
|
108
|
|
|
|
|
216
|
|
|
108
|
|
|
|
|
2928
|
|
7
|
|
|
|
|
|
|
|
8
|
108
|
|
|
108
|
|
530
|
use base 'Validation::Class::Directive'; |
|
108
|
|
|
|
|
257
|
|
|
108
|
|
|
|
|
8440
|
|
9
|
|
|
|
|
|
|
|
10
|
108
|
|
|
108
|
|
645
|
use Validation::Class::Util; |
|
108
|
|
|
|
|
214
|
|
|
108
|
|
|
|
|
741
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '7.900057'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'mixin' => 1; |
16
|
|
|
|
|
|
|
has 'field' => 1; |
17
|
|
|
|
|
|
|
has 'multi' => 0; |
18
|
|
|
|
|
|
|
has 'message' => '%s is not a valid social security number'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub validate { |
21
|
|
|
|
|
|
|
|
22
|
14
|
|
|
14
|
0
|
36
|
my ($self, $proto, $field, $param) = @_; |
23
|
|
|
|
|
|
|
|
24
|
14
|
50
|
33
|
|
|
85
|
if (defined $field->{ssn} && defined $param) { |
25
|
|
|
|
|
|
|
|
26
|
14
|
50
|
33
|
|
|
74
|
if ($field->{required} || $param) { |
27
|
|
|
|
|
|
|
|
28
|
14
|
|
|
|
|
74
|
my $ssnre = qr/\A\b(?!000)[0-9]{3}-[0-9]{2}-[0-9]{4}\b\z/i; |
29
|
14
|
100
|
|
|
|
165
|
$self->error($proto, $field) unless $param =~ $ssnre; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
14
|
|
|
|
|
52
|
return $self; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |