line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Validation::Constraints::Email; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
560
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
78
|
use Data::Validation::Constants qw( EXCEPTION_CLASS FALSE TRUE ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
10
|
|
6
|
1
|
|
|
1
|
|
860
|
use Email::Valid; |
|
1
|
|
|
|
|
78869
|
|
|
1
|
|
|
|
|
37
|
|
7
|
1
|
|
|
1
|
|
8
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends q(Data::Validation::Constraints); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
EXCEPTION_CLASS->add_exception( 'ValidEmail', { |
12
|
|
|
|
|
|
|
parents => [ 'InvalidParameter' ], |
13
|
|
|
|
|
|
|
error => 'Parameter [_1] is not a valid email address' } ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub validate { |
16
|
7
|
100
|
|
7
|
1
|
40
|
return Email::Valid->address( $_[ 1 ] ) ? TRUE : FALSE; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Local Variables: |
22
|
|
|
|
|
|
|
# mode: perl |
23
|
|
|
|
|
|
|
# tab-width: 3 |
24
|
|
|
|
|
|
|
# End: |