| 1 | package Email::IsFree; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | $VERSION = '0.02'; | |||||||||
| 9 | |||||||||||
| 10 | 1 | my %domains; | |||||||||
| 11 | |||||||||||
| 12 | 1 | ▶ | while (<DATA>) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | 6857 | chomp; | |||||||||
| 14 | 6857 | $domains{$_} = 1; | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | 4 | ▶ | sub by_domain { | ||||||||
|
Subroutine
by_domain: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 18 | 4 | my $domain = shift; | |||||||||
| 19 | 4 | ▶ | return exists $domains{$domain} ? 1 : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 2 | ▶ | sub by_email { | ||||||||
|
Subroutine
by_email: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 23 | 2 | my $email = shift; | |||||||||
| 24 | 2 | return by_domain((split('@',$email))[-1]); | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 1 | 1; | |||||||||
| 28 | |||||||||||
| 29 | =pod | ||||||||||
| 30 | |||||||||||
| 31 | =head1 NAME | ||||||||||
| 32 | |||||||||||
| 33 | Email::IsFree - Detect whether e-mail is from free provider | ||||||||||
| 34 | |||||||||||
| 35 | =head1 SYNOPSIS | ||||||||||
| 36 | |||||||||||
| 37 | use Email::IsFree; | ||||||||||
| 38 | |||||||||||
| 39 | # returns 1 | ||||||||||
| 40 | print Email::IsFree::by_domain("hotmail.com"); | ||||||||||
| 41 | print Email::IsFree::by_email("foo@hotmail.com"); | ||||||||||
| 42 | |||||||||||
| 43 | # returns 0 | ||||||||||
| 44 | print Email::IsFree::by_domain("aol.com"); | ||||||||||
| 45 | print Email::IsFree::by_email("bar@aol.com"); | ||||||||||
| 46 | |||||||||||
| 47 | =head1 ABSTRACT | ||||||||||
| 48 | |||||||||||
| 49 | This module detects whether an e-mail address belongs to a | ||||||||||
| 50 | free e-mail provider such as hotmail.com or yahoo.com. It | ||||||||||
| 51 | currently contains over 6000 domains. Additions and | ||||||||||
| 52 | corrections are welcome. | ||||||||||
| 53 | |||||||||||
| 54 | =head1 DESCRIPTION | ||||||||||
| 55 | |||||||||||
| 56 | This module can be used to screen credit card orders based | ||||||||||
| 57 | on e-mail. Many credit card scamsters use free, anonymous | ||||||||||
| 58 | email accounts with another person's name to place fraudulent | ||||||||||
| 59 | orders. | ||||||||||
| 60 | |||||||||||
| 61 | =head1 AUTHOR | ||||||||||
| 62 | |||||||||||
| 63 | TJ Mather, E<lt>tjmather@maxmind.comE<gt> | ||||||||||
| 64 | |||||||||||
| 65 | =head1 CREDITS | ||||||||||
| 66 | |||||||||||
| 67 | The following people have contributed free e-mail domains: | ||||||||||
| 68 | |||||||||||
| 69 | Robert Young | ||||||||||
| 70 | David J | ||||||||||
| 71 | |||||||||||
| 72 | Thanks! | ||||||||||
| 73 | |||||||||||
| 74 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 75 | |||||||||||
| 76 | Copyright 2003 by MaxMind LLC | ||||||||||
| 77 | |||||||||||
| 78 | This library is free software; you can redistribute it and/or modify | ||||||||||
| 79 | it under the same terms as Perl itself. | ||||||||||
| 80 | |||||||||||
| 81 | =cut | ||||||||||
| 82 | |||||||||||
| 83 | __DATA__ | ||||||||||