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
|
109
|
|
|
109
|
|
55877
|
use strict; |
|
109
|
|
|
|
|
303
|
|
|
109
|
|
|
|
|
3175
|
|
6
|
109
|
|
|
109
|
|
636
|
use warnings; |
|
109
|
|
|
|
|
281
|
|
|
109
|
|
|
|
|
3098
|
|
7
|
|
|
|
|
|
|
|
8
|
109
|
|
|
109
|
|
602
|
use base 'Validation::Class::Directive'; |
|
109
|
|
|
|
|
301
|
|
|
109
|
|
|
|
|
11432
|
|
9
|
|
|
|
|
|
|
|
10
|
109
|
|
|
109
|
|
890
|
use Validation::Class::Util; |
|
109
|
|
|
|
|
323
|
|
|
109
|
|
|
|
|
821
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '7.900059'; # 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
|
|
|
60
|
if (defined $field->{ssn} && defined $param) { |
25
|
|
|
|
|
|
|
|
26
|
14
|
50
|
33
|
|
|
52
|
if ($field->{required} || $param) { |
27
|
|
|
|
|
|
|
|
28
|
14
|
|
|
|
|
53
|
my $ssnre = qr/\A\b(?!000)[0-9]{3}-[0-9]{2}-[0-9]{4}\b\z/i; |
29
|
14
|
100
|
|
|
|
132
|
$self->error($proto, $field) unless $param =~ $ssnre; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
14
|
|
|
|
|
43
|
return $self; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |