| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Email::IsFree::CN; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20984
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
34
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
25
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
|
1
|
|
|
|
|
10
|
|
|
|
1
|
|
|
|
|
189
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '0.01'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
|
11
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
12
|
0
|
|
|
|
|
|
my %domains; |
|
13
|
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
while () { |
|
15
|
0
|
|
|
|
|
|
chomp; |
|
16
|
0
|
|
|
|
|
|
$domains{$_} = 1; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
bless { domains => \%domains },$class; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub by_domain { |
|
23
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
24
|
0
|
|
|
|
|
|
my $domain = lc(+shift); |
|
25
|
0
|
0
|
|
|
|
|
return exists $self->{domains}->{$domain} ? 1 : 0; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub by_email { |
|
29
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
30
|
0
|
|
|
|
|
|
my $email = shift; |
|
31
|
0
|
|
|
|
|
|
return $self->by_domain((split('@',$email))[-1]); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Email::IsFree::CN - Detect whether e-mail is from free provider in China |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
use Email::IsFree::CN; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $cnfm = Email::IsFree::CN->new; |
|
47
|
|
|
|
|
|
|
print $cnfm->by_domain('163.com'); # print 1 |
|
48
|
|
|
|
|
|
|
print $cnfm->by_email('foo@sina.com'); # print 1 |
|
49
|
|
|
|
|
|
|
print $cnfm->by_email('bar@vip.163.com'); # print 0 |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 ABSTRACT |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This module detects whether an e-mail address belongs to a |
|
54
|
|
|
|
|
|
|
free e-mail provider in China such as 163.com or sina.com. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This module can be used to screen credit card orders based |
|
59
|
|
|
|
|
|
|
on e-mail. Many credit card scamsters use free, anonymous |
|
60
|
|
|
|
|
|
|
email accounts with another person's name to place fraudulent |
|
61
|
|
|
|
|
|
|
orders. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHOR |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Xiaolan Fu |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 CREDITS |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
I got the idea from the module Email::IsFree whose author is |
|
70
|
|
|
|
|
|
|
TJ Mather, thanks. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Copyright 2009 by Xiaolan Fu |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
77
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__DATA__ |