r13567 - in /branches/upstream/libcgi-untaint-email-perl: ./ current/ current/lib/ current/lib/CGI/ current/lib/CGI/Untaint/ current/t/

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Sat Jan 26 08:07:08 UTC 2008


Author: dmn
Date: Sat Jan 26 08:07:08 2008
New Revision: 13567

URL: http://svn.debian.org/wsvn/?sc=1&rev=13567
Log:
[svn-inject] Installing original source of libcgi-untaint-email-perl

Added:
    branches/upstream/libcgi-untaint-email-perl/
    branches/upstream/libcgi-untaint-email-perl/current/
    branches/upstream/libcgi-untaint-email-perl/current/Changes
    branches/upstream/libcgi-untaint-email-perl/current/MANIFEST
    branches/upstream/libcgi-untaint-email-perl/current/Makefile.PL
    branches/upstream/libcgi-untaint-email-perl/current/README
    branches/upstream/libcgi-untaint-email-perl/current/lib/
    branches/upstream/libcgi-untaint-email-perl/current/lib/CGI/
    branches/upstream/libcgi-untaint-email-perl/current/lib/CGI/Untaint/
    branches/upstream/libcgi-untaint-email-perl/current/lib/CGI/Untaint/email.pm
    branches/upstream/libcgi-untaint-email-perl/current/t/
    branches/upstream/libcgi-untaint-email-perl/current/t/00_email.t   (with props)

Added: branches/upstream/libcgi-untaint-email-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libcgi-untaint-email-perl/current/Changes?rev=13567&op=file
==============================================================================
--- branches/upstream/libcgi-untaint-email-perl/current/Changes (added)
+++ branches/upstream/libcgi-untaint-email-perl/current/Changes Sat Jan 26 08:07:08 2008
@@ -1,0 +1,13 @@
+Revision 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
+

Added: branches/upstream/libcgi-untaint-email-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libcgi-untaint-email-perl/current/MANIFEST?rev=13567&op=file
==============================================================================
--- branches/upstream/libcgi-untaint-email-perl/current/MANIFEST (added)
+++ branches/upstream/libcgi-untaint-email-perl/current/MANIFEST Sat Jan 26 08:07:08 2008
@@ -1,0 +1,6 @@
+Changes
+MANIFEST
+Makefile.PL
+README
+lib/CGI/Untaint/email.pm
+t/00_email.t

Added: branches/upstream/libcgi-untaint-email-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libcgi-untaint-email-perl/current/Makefile.PL?rev=13567&op=file
==============================================================================
--- branches/upstream/libcgi-untaint-email-perl/current/Makefile.PL (added)
+++ branches/upstream/libcgi-untaint-email-perl/current/Makefile.PL Sat Jan 26 08:07:08 2008
@@ -1,0 +1,13 @@
+use 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,
+    },
+);

Added: branches/upstream/libcgi-untaint-email-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libcgi-untaint-email-perl/current/README?rev=13567&op=file
==============================================================================
--- branches/upstream/libcgi-untaint-email-perl/current/README (added)
+++ branches/upstream/libcgi-untaint-email-perl/current/README Sat Jan 26 08:07:08 2008
@@ -1,0 +1,24 @@
+NAME
+    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 <miyagawa at bulknews.net>
+
+    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
+

Added: branches/upstream/libcgi-untaint-email-perl/current/lib/CGI/Untaint/email.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libcgi-untaint-email-perl/current/lib/CGI/Untaint/email.pm?rev=13567&op=file
==============================================================================
--- branches/upstream/libcgi-untaint-email-perl/current/lib/CGI/Untaint/email.pm (added)
+++ branches/upstream/libcgi-untaint-email-perl/current/lib/CGI/Untaint/email.pm Sat Jan 26 08:07:08 2008
@@ -1,0 +1,65 @@
+package 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 E<lt>miyagawa at bulknews.netE<gt>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<CGI::Untaint>, L<Email::Valid>
+
+=cut

Added: branches/upstream/libcgi-untaint-email-perl/current/t/00_email.t
URL: http://svn.debian.org/wsvn/branches/upstream/libcgi-untaint-email-perl/current/t/00_email.t?rev=13567&op=file
==============================================================================
--- branches/upstream/libcgi-untaint-email-perl/current/t/00_email.t (added)
+++ branches/upstream/libcgi-untaint-email-perl/current/t/00_email.t Sat Jan 26 08:07:08 2008
@@ -1,0 +1,29 @@
+use strict;
+use Test::More tests => 4;
+
+use CGI;
+use CGI::Untaint;
+
+my @ok  = (
+    'miyagawa at cpan.org',
+    'Tatsuhiko Miyagawa <miyagawa at cpan.org>',
+);
+
+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';
+}

Propchange: branches/upstream/libcgi-untaint-email-perl/current/t/00_email.t
------------------------------------------------------------------------------
    svn:executable = 




More information about the Pkg-perl-cvs-commits mailing list