line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::ValidOp::Check::email; |
2
|
4
|
|
|
4
|
|
24
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
171
|
|
3
|
4
|
|
|
4
|
|
23
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
169
|
|
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
23
|
use base qw/ CGI::ValidOp::Check /; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
1570
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub default { |
8
|
39
|
|
|
39
|
0
|
61
|
my $self = shift; |
9
|
|
|
|
|
|
|
sub { |
10
|
39
|
|
|
39
|
|
84
|
my ( $tainted ) = @_; |
11
|
39
|
100
|
|
|
|
113
|
return $self->pass() unless $tainted; |
12
|
38
|
|
|
|
|
138
|
$tainted =~ /^(.*)$/s; |
13
|
38
|
|
|
|
|
97
|
my $value = $1; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# For now only very basic validation. |
16
|
|
|
|
|
|
|
# Make sure we have data before and after an @ symbol, and make sure the |
17
|
|
|
|
|
|
|
# data after the @ symbol contains at least one period. |
18
|
|
|
|
|
|
|
# For full validation we may want to use an existing cpan module. |
19
|
|
|
|
|
|
|
# Found a perl regex that is 100% compliant e-mail validation, |
20
|
|
|
|
|
|
|
# however it made me laugh really hard: |
21
|
|
|
|
|
|
|
# http://ex-parrot.com/~pdw/Mail-RFC822-Address.html |
22
|
38
|
100
|
100
|
|
|
358
|
return $self->fail( "\$label: '$value' is not a valid email address." ) |
23
|
|
|
|
|
|
|
if $value =~ m/\@.*\@/ig or not $value =~ m/.+\@.+\..+/ig; |
24
|
|
|
|
|
|
|
|
25
|
34
|
|
|
|
|
121
|
return $self->pass( $value ); |
26
|
|
|
|
|
|
|
} |
27
|
39
|
|
|
|
|
510
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |