line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Email Directive for Validation Class Field Definitions |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Validation::Class::Directive::Email; |
4
|
|
|
|
|
|
|
|
5
|
108
|
|
|
108
|
|
69055
|
use strict; |
|
108
|
|
|
|
|
214
|
|
|
108
|
|
|
|
|
2822
|
|
6
|
108
|
|
|
108
|
|
545
|
use warnings; |
|
108
|
|
|
|
|
207
|
|
|
108
|
|
|
|
|
2929
|
|
7
|
|
|
|
|
|
|
|
8
|
108
|
|
|
108
|
|
580
|
use base 'Validation::Class::Directive'; |
|
108
|
|
|
|
|
258
|
|
|
108
|
|
|
|
|
7637
|
|
9
|
|
|
|
|
|
|
|
10
|
108
|
|
|
108
|
|
644
|
use Validation::Class::Util; |
|
108
|
|
|
|
|
236
|
|
|
108
|
|
|
|
|
765
|
|
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 requires a valid email address'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub validate { |
21
|
|
|
|
|
|
|
|
22
|
15
|
|
|
15
|
0
|
36
|
my ($self, $proto, $field, $param) = @_; |
23
|
|
|
|
|
|
|
|
24
|
15
|
50
|
33
|
|
|
92
|
if (defined $field->{email} && defined $param) { |
25
|
|
|
|
|
|
|
|
26
|
15
|
50
|
66
|
|
|
70
|
if ($field->{required} || $param) { |
27
|
|
|
|
|
|
|
|
28
|
15
|
|
|
|
|
415
|
my $ere = qr/^[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[-_a-z0-9][-_a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,4}|museum|travel)$/; |
29
|
|
|
|
|
|
|
|
30
|
15
|
100
|
|
|
|
199
|
$self->error($proto, $field) unless $param =~ $ere; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
15
|
|
|
|
|
50
|
return $self; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |