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
|
|
44732
|
use strict; |
|
109
|
|
|
|
|
218
|
|
|
109
|
|
|
|
|
2795
|
|
6
|
109
|
|
|
109
|
|
523
|
use warnings; |
|
109
|
|
|
|
|
218
|
|
|
109
|
|
|
|
|
2606
|
|
7
|
|
|
|
|
|
|
|
8
|
109
|
|
|
109
|
|
533
|
use base 'Validation::Class::Directive'; |
|
109
|
|
|
|
|
216
|
|
|
109
|
|
|
|
|
9597
|
|
9
|
|
|
|
|
|
|
|
10
|
109
|
|
|
109
|
|
710
|
use Validation::Class::Util; |
|
109
|
|
|
|
|
243
|
|
|
109
|
|
|
|
|
640
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '7.900058'; # 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
|
32
|
my ($self, $proto, $field, $param) = @_; |
23
|
|
|
|
|
|
|
|
24
|
14
|
50
|
33
|
|
|
72
|
if (defined $field->{ssn} && defined $param) { |
25
|
|
|
|
|
|
|
|
26
|
14
|
50
|
33
|
|
|
57
|
if ($field->{required} || $param) { |
27
|
|
|
|
|
|
|
|
28
|
14
|
|
|
|
|
46
|
my $ssnre = qr/\A\b(?!000)[0-9]{3}-[0-9]{2}-[0-9]{4}\b\z/i; |
29
|
14
|
100
|
|
|
|
115
|
$self->error($proto, $field) unless $param =~ $ssnre; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
14
|
|
|
|
|
36
|
return $self; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |