CGI-Untaint-email-0.03/ 40755 1751 1751 0 7367241072 13540 5ustar miyagawauserCGI-Untaint-email-0.03/Makefile.PL100644 1751 1751 572 7367240673 15601 0ustar miyagawauseruse ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'CGI::Untaint::email', 'VERSION_FROM' => 'lib/CGI/Untaint/email.pm', # finds $VERSION 'PREREQ_PM' => { Test::More => 0.18, CGI::Untaint => 0.07, Email::Valid => 0.13, Mail::Address => 1.40, }, ); CGI-Untaint-email-0.03/Changes100644 1751 1751 530 7367236632 15114 0ustar miyagawauserRevision history for Perl extension CGI::Untaint::email. 0.03 Mon Oct 29 20:28:29 JST 2001 * returned value is not string, but subclass of Mail::Address which overloads. 0.02 Fri Oct 26 22:53:01 JST 2001 - Fixed is_valid() (Thanks to Tony Bowden) - onto CPAN 0.01 Fri Oct 26 03:47:50 2001 - original version; created by h2xs 1.19 CGI-Untaint-email-0.03/t/ 40755 1751 1751 0 7367241072 14003 5ustar miyagawauserCGI-Untaint-email-0.03/t/00_email.t100755 1751 1751 1052 7367237175 15665 0ustar miyagawauseruse strict; use Test::More tests => 4; use CGI; use CGI::Untaint; my @ok = ( 'miyagawa@cpan.org', 'Tatsuhiko Miyagawa ', ); my @not = ( 'miyagawa at cpan dot org', ); my $count = 0; my %hash = map { 'var' . $count++ => $_ } @ok, @not; my $q = CGI->new(\%hash); ok my $handler = CGI::Untaint->new($q->Vars), 'create the handler'; $count = 0; for (@ok) { is $handler->extract(-as_email => 'var' . $count++), $_, 'Valid'; } for (@not) { is $handler->extract(-as_email => 'var' . $count++), undef, 'Invalid'; } CGI-Untaint-email-0.03/lib/ 40755 1751 1751 0 7367241072 14306 5ustar miyagawauserCGI-Untaint-email-0.03/lib/CGI/ 40755 1751 1751 0 7367241072 14710 5ustar miyagawauserCGI-Untaint-email-0.03/lib/CGI/Untaint/ 40755 1751 1751 0 7367241072 16332 5ustar miyagawauserCGI-Untaint-email-0.03/lib/CGI/Untaint/email.pm100644 1751 1751 2303 7367241021 20044 0ustar miyagawauserpackage CGI::Untaint::email; use strict; use vars qw($VERSION); $VERSION = '0.03'; use base qw(CGI::Untaint::printable); use Email::Valid; use Mail::Address; my $validator = Email::Valid->new( -fudge => 0, -fqdn => 1, -local_rules => 0, -mxcheck => 0, ); sub is_valid { my $self = shift; if ($validator->address($self->value)) { my @address = Mail::Address::overload->parse($self->value); return $self->value($address[0]); } return; } package Mail::Address::overload; use base qw(Mail::Address); use overload '""' => sub { $_[0]->format }, fallback => 1; 1; __END__ =head1 NAME CGI::Untaint::email - validate an email address =head1 SYNOPSIS use CGI::Untaint; my $handler = CGI::Untaint->new($q->Vars); my $email = $handler->extract(-as_email => 'emailaddress'); =head1 DESCRIPTION CGI::Untaint::email input handler verifies that it is a valid RFC2822 mailbox format. The resulting value will be a Mail::Address instance. =head1 AUTHOR Tatsuhiko Miyagawa Emiyagawa@bulknews.netE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO L, L =cut CGI-Untaint-email-0.03/README100644 1751 1751 1144 7367241033 14512 0ustar miyagawauserNAME CGI::Untaint::email - validate an email address SYNOPSIS use CGI::Untaint; my $handler = CGI::Untaint->new($q->Vars); my $email = $handler->extract(-as_email => 'emailaddress'); DESCRIPTION CGI::Untaint::email input handler verifies that it is a valid RFC2822 mailbox format. The resulting value will be a Mail::Address instance. AUTHOR Tatsuhiko Miyagawa This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO the CGI::Untaint manpage, the Email::Valid manpage CGI-Untaint-email-0.03/MANIFEST100644 1751 1751 112 7366265402 14742 0ustar miyagawauserChanges MANIFEST Makefile.PL README lib/CGI/Untaint/email.pm t/00_email.t