line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Validation::Constraints::Email; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
625
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
75
|
use Data::Validation::Constants qw( EXCEPTION_CLASS FALSE TRUE ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
6
|
1
|
|
|
1
|
|
776
|
use Email::Valid; |
|
1
|
|
|
|
|
74209
|
|
|
1
|
|
|
|
|
50
|
|
7
|
1
|
|
|
1
|
|
9
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
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
|
49
|
return Email::Valid->address( $_[ 1 ] ) ? TRUE : FALSE; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Local Variables: |
22
|
|
|
|
|
|
|
# mode: perl |
23
|
|
|
|
|
|
|
# tab-width: 3 |
24
|
|
|
|
|
|
|
# End: |