line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Format::Validate::Email; |
2
|
|
|
|
|
|
|
our $VERSION = q/0.3/; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
131271
|
use Carp; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
84
|
|
5
|
2
|
|
|
2
|
|
9
|
use base q/Exporter/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
496
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ |
8
|
|
|
|
|
|
|
looks_like_any_email |
9
|
|
|
|
|
|
|
looks_like_common_email |
10
|
|
|
|
|
|
|
/; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
13
|
|
|
|
|
|
|
q/all/ => [qw/ |
14
|
|
|
|
|
|
|
looks_like_any_email |
15
|
|
|
|
|
|
|
looks_like_common_email |
16
|
|
|
|
|
|
|
/] |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub looks_like_any_email { |
20
|
|
|
|
|
|
|
|
21
|
5
|
|
33
|
5
|
0
|
89
|
my $email = shift || croak q/Value most be provided/; |
22
|
5
|
|
|
|
|
26
|
$email =~ /^ |
23
|
|
|
|
|
|
|
\S+ # Username (visible digits) |
24
|
|
|
|
|
|
|
@ # at |
25
|
|
|
|
|
|
|
\S+ # Server (visible digits) |
26
|
|
|
|
|
|
|
$/x |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub looks_like_common_email { |
30
|
|
|
|
|
|
|
|
31
|
15
|
|
33
|
15
|
0
|
110
|
my $email = shift || croak q/Value most be provided/; |
32
|
15
|
|
|
|
|
96
|
$email =~ /^ |
33
|
|
|
|
|
|
|
\w+(?:\.\w+)* # Username, can contain '.', but cant end with |
34
|
|
|
|
|
|
|
@ # at |
35
|
|
|
|
|
|
|
(?:[A-Z0-9-]+\.)+ # Server, can contain alphanumeric digits and '-' |
36
|
|
|
|
|
|
|
[A-Z]{2,6} # Final part of servername, 2 to 6 letters |
37
|
|
|
|
|
|
|
$/ix |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=pod |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=encoding utf8 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Data::Format::Validate::Email - A e-mail validating module. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Function-oriented module capable of validating the format of any email, or only the common ones. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 UTILITIES |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=over 4 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item Any E-mail |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
use Data::Format::Validate::Email 'looks_like_any_email'; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
looks_like_any_email 'rozcovo@cpan.org'; # returns 1 |
62
|
|
|
|
|
|
|
looks_like_any_email 'rozcovo@cpan. org'; # returns 0 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item Common E-mail |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
use Data::Format::Validate::Email 'looks_like_common_email'; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
looks_like_common_email 'rozcovo@cpan.org'; # returns 1 |
69
|
|
|
|
|
|
|
looks_like_common_email 'rozcovo.@cpan.org'; # returns 0 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=back |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 CONTRIBUITION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This source is on Github: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
https://github.com/rozcovo/Data-Format-Validate/blob/master/lib/Data/Format/Validate/Email.pm |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Created by Israel Batista |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |