Changeset 5

Show
Ignore:
Timestamp:
02/12/00 15:37:52
Author:
schwern
Message:

Version 0.01

Released to CPAN

Turned on Email::Valid.

Added a cruft clipper to the end of the email.

Added a COPYRIGHT and anti-spam LICENSE.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Email-Find/trunk/lib/Email/Find.pm

    r4 r5  
    1212@EXPORT = qw(find_emails); 
    1313 
    14 #use Email::Valid; 
     14use Email::Valid; 
    1515require Mail::Address; 
    1616 
     
    6464                  /x; 
    6565 
     66my $validator = Email::Valid->new('-fudge'      => 1, 
     67                                  '-fqdn'       => 1, 
     68                                  '-local_rules' => 1, 
     69                                  '-mxcheck'    => 0, 
     70                                 ); 
    6671 
    6772sub find_emails (\$&) { 
     
    7479 
    7580        # XXX Add cruft handling. 
    76  
    77         if( my $email = Mail::Address->new('',$orig_match) ) { 
     81        my($start_cruft) = ''; 
     82        my($end_cruft)   = ''; 
     83        if( $orig_match =~ s|([),.'";?!]+)$|| ) {  
     84            $end_cruft = $1;  
     85        }  
     86 
     87        if( my $email = $validator->address($orig_match) ) { 
     88            $email = Mail::Address->new('', $email); 
    7889            $emails_found++; 
    7990 
    80             # XXX Don't forget the cruft. 
    81             $callback->($email, $orig_match); 
     91            $start_cruft . $callback->($email, $orig_match) . $end_cruft; 
    8292        } 
    8393        else { 
    8494            # XXX Again with the cruft! 
    85             $orig_match; 
     95 
     96            $start_cruft . $orig_match . $end_cruft; 
    8697        } 
    8798    }eg; 
     
    213224=head1 AUTHOR 
    214225 
    215 Michael G Schwern <schwern@pobox.com> 
     226Copyright 2000, Michael G Schwern <schwern@pobox.com>. 
     227All rights reserved. 
     228 
     229=head1 LICENSE 
     230 
     231This module may not be used for the purposes of sending unsolicited 
     232email (ie. spamming) in any way, shape or form or for the purposes of 
     233generating lists for commercial sale without explicit permission from 
     234the author. 
     235 
     236For everyone else this module is free software; you may redistribute 
     237it and/or modify it under the same terms as Perl itself. 
     238 
     239 
    216240 
    217241