| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Email::IsFree; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 8357 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 53 |  | 
| 4 | 1 |  |  | 1 |  | 6 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 39 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 1 |  |  | 1 |  | 5 | use vars qw($VERSION); | 
|  | 1 |  |  |  |  | 6 |  | 
|  | 1 |  |  |  |  | 248 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | $VERSION = '0.02'; | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | my %domains; | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | while () { | 
| 13 |  |  |  |  |  |  | chomp; | 
| 14 |  |  |  |  |  |  | $domains{$_} = 1; | 
| 15 |  |  |  |  |  |  | } | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | sub by_domain { | 
| 18 | 4 |  |  | 4 | 0 | 93 | my $domain = shift; | 
| 19 | 4 | 100 |  |  |  | 20 | return exists $domains{$domain} ? 1 : 0; | 
| 20 |  |  |  |  |  |  | } | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub by_email { | 
| 23 | 2 |  |  | 2 | 0 | 4 | my $email = shift; | 
| 24 | 2 |  |  |  |  | 10 | return by_domain((split('@',$email))[-1]); | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | 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, Etjmather@maxmind.comE | 
| 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__ |