r2955 - in /packages/libemail-valid-perl/trunk: Changes META.yml debian/changelog lib/Email/Valid.pm t/valid.t

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Mon Jun 12 22:17:40 UTC 2006


Author: gregoa-guest
Date: Mon Jun 12 22:17:39 2006
New Revision: 2955

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=2955
Log:
* New upstream release.

Modified:
    packages/libemail-valid-perl/trunk/Changes
    packages/libemail-valid-perl/trunk/META.yml
    packages/libemail-valid-perl/trunk/debian/changelog
    packages/libemail-valid-perl/trunk/lib/Email/Valid.pm
    packages/libemail-valid-perl/trunk/t/valid.t

Modified: packages/libemail-valid-perl/trunk/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-valid-perl/trunk/Changes?rev=2955&op=diff
==============================================================================
--- packages/libemail-valid-perl/trunk/Changes (original)
+++ packages/libemail-valid-perl/trunk/Changes Mon Jun 12 22:17:39 2006
@@ -1,79 +1,83 @@
 Revision history for Perl extension Email::Valid.
 
-0.16 Fri Jun  2
-        - maintainership assumed by RJBS
-        - work with current, broken Net::Domain::TLD
-        - improve tests
+0.171   Sat Jun 10 2006
+        fixed a problem with the test plan
+
+0.170   Thu Jun  8 2006
+        fix details on failures for mxcheck and tldcheck
+        don't screw up addresses beginning with a dash
+        try to work on win32 where forking open is busted (thanks Smylers)
+        improve tests
+
+0.16    Fri Jun  2 2006
+        maintainership assumed by RJBS
+        work with current, broken Net::Domain::TLD
+        improve tests
 
 
-0.15 Sun Sep  7 21:39:12 PDT 2003
-        - Support for top level domain validity check added by Elizabeth
+0.15    Sun Sep  7 21:39:12 PDT 2003
+        Support for top level domain validity check added by Elizabeth
           Mattijsen (liz at dijkmat.nl).  Updated documentation and added tests.
-        - Patch to improve portability when looking
-          for nslookup executable.  Thanks to Chromatic<chromatic at wgz.org>
-        - Update AOL rules in local_rules check thanks to
-          Paul Fierro <pablo at nothing.com>
+        Patch to improve portability when looking for nslookup executable.
+          Thanks to Chromatic<chromatic at wgz.org>
+        Update AOL rules in local_rules check thanks to Paul Fierro
+          <pablo at nothing.com>
 
-0.14 Wed Jul  3 12:58:50 CEST 2002
-        - Applied patch from Michael G Schwern <schwern at pobox.com>
-          to remove 'use UNIVERSAL'.
+0.14    Wed Jul  3 12:58:50 CEST 2002
+        Applied patch from Michael G Schwern <schwern at pobox.com> to remove 'use
+          UNIVERSAL'.
    
-0.13 Tue Jan 16 13:25:57 PST 2001    
-        - Only load Net::DNS module if required
+0.13    Tue Jan 16 13:25:57 PST 2001    
+        Only load Net::DNS module if required
 
-0.12 Thu Jul  8 22:26:41 PDT 1999
-	- Added details() method to determine why an
-          address check fails.  Thanks to Otis Gospodnetic
-          for the suggestion.      
-        - Global Net::DNS::Resolver object is now used for
-          DNS queries when Net::DNS is available.  Can be accessed 
-          directly to tweak the resolver behavior.
-        - The address() method now returns an additional
-          value (an instance of the Mail::Address class)
-          when called in a list context.  
-        - Updated documentation.
+0.12    Thu Jul  8 22:26:41 PDT 1999
+        Added details() method to determine why an address check fails.
+          Thanks to Otis Gospodnetic for the suggestion.      
+        Global Net::DNS::Resolver object is now used for DNS queries when
+          Net::DNS is available.  Can be accessed directly to tweak the
+          resolver behavior.
+        The address() method now returns an additional value (an instance of
+          the Mail::Address class) when called in a list context.  
+        Updated documentation.
 
-0.11 Wed Jul  7 04:33:58 PDT 1999  
-        - Changed name to Mail::Address
-        - RELEASE WITHDRAWN PENDING DISCUSSION OF THIS NAME CHANGE
+0.11    Wed Jul  7 04:33:58 PDT 1999  
+        Changed name to Mail::Address
+        RELEASE WITHDRAWN PENDING DISCUSSION OF THIS NAME CHANGE
 
-0.09 Thu Apr  8 17:21:15 PDT 1999
-        - Added Mail::Address to PREREQ_PM to list
-          dependency, as suggested by Achim.
-        - Moved test.pl to t/valid.t as suggested by Achim.
-        - DNS lookups now use Net::DNS if available, falling
-          back to nslookup if not.  Suggested by
-          Lupe Christoph.
-        - Modified documentation
-        - Renamed Email::Valid::NSLookup to Email::Valid::DNS,
-          which is now responsible for all DNS queries.
+0.09    Thu Apr  8 17:21:15 PDT 1999
+        Added Mail::Address to PREREQ_PM to list dependency, as suggested by
+          Achim.
+        Moved test.pl to t/valid.t as suggested by Achim.
+        DNS lookups now use Net::DNS if available, falling back to nslookup if
+          not.  Suggested by Lupe Christoph.
+        Modified documentation
+        Renamed Email::Valid::NSLookup to Email::Valid::DNS, which is now
+          responsible for all DNS queries.
         
 0.08
-	- Removed a couple of warnings when running under -w
-	- Bug handling AOL local rules fixed
-	- local_rules() now defaults to off
+	      Removed a couple of warnings when running under -w
+        Bug handling AOL local rules fixed
+        local_rules() now defaults to off
 
-0.07 Tue Jan 12 02:04:57 PST 1999
-	- Mail::Address module is now required
-        - Added Email::Valid::NSLookup module to
-          encapsulate DNS lookups -- now we can
-          add additional classes to use other utilities.
-        - Fixed problem with spaces thanks to David Birnbaum.
-        - Renamed a couple of the parameters -- old names
-          should still work.
+0.07    Tue Jan 12 02:04:57 PST 1999
+        Mail::Address module is now required
+        Added Email::Valid::NSLookup module to encapsulate DNS lookups -- now
+          we can add additional classes to use other utilities.
+        Fixed problem with spaces thanks to David Birnbaum.
+        Renamed a couple of the parameters -- old names should still work.
 
-0.06 Tue May 26 14:27:34 1998
-        - Modified named parameter parsing
+0.06    Tue May 26 14:27:34 1998
+        Modified named parameter parsing
 
-0.05  Mon May 11 00:56:00 1998
-        - fudge() now defaults to false
-        - Modified documentation
-        - Changed behavior of fully_qualified
+0.05    Mon May 11 00:56:00 1998
+        fudge() now defaults to false
+        Modified documentation
+        Changed behavior of fully_qualified
 
-0.04  Thu May  7 16:42:00 1998
-        - Added support for Mail::Address objects
-        - Added positional/named parameter calling style
-        - Updated documentation
+0.04    Thu May  7 16:42:00 1998
+        Added support for Mail::Address objects
+        Added positional/named parameter calling style
+        Updated documentation
 
-0.01  Fri Mar  6 22:19:54 1998
-        - original version; created by h2xs 1.18      
+0.01    Fri Mar  6 22:19:54 1998
+        original version; created by h2xs 1.18      

Modified: packages/libemail-valid-perl/trunk/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-valid-perl/trunk/META.yml?rev=2955&op=diff
==============================================================================
--- packages/libemail-valid-perl/trunk/META.yml (original)
+++ packages/libemail-valid-perl/trunk/META.yml Mon Jun 12 22:17:39 2006
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Email-Valid
-version:      0.16
+version:      0.171
 version_from: lib/Email/Valid.pm
 installdirs:  site
 requires:

Modified: packages/libemail-valid-perl/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-valid-perl/trunk/debian/changelog?rev=2955&op=diff
==============================================================================
--- packages/libemail-valid-perl/trunk/debian/changelog (original)
+++ packages/libemail-valid-perl/trunk/debian/changelog Mon Jun 12 22:17:39 2006
@@ -1,3 +1,9 @@
+libemail-valid-perl (0.171-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at>  Tue, 13 Jun 2006 00:17:17 +0200
+
 libemail-valid-perl (0.16-1) unstable; urgency=low
 
   * New upstream release.

Modified: packages/libemail-valid-perl/trunk/lib/Email/Valid.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-valid-perl/trunk/lib/Email/Valid.pm?rev=2955&op=diff
==============================================================================
--- packages/libemail-valid-perl/trunk/lib/Email/Valid.pm (original)
+++ packages/libemail-valid-perl/trunk/lib/Email/Valid.pm Mon Jun 12 22:17:39 2006
@@ -9,9 +9,16 @@
 use Mail::Address;
 use File::Spec;
 
-$VERSION = '0.16';
-
-%AUTOLOAD = ( mxcheck => 1, tldcheck => 1, fudge => 1, fqdn => 1, local_rules => 1 );
+$VERSION = '0.171';
+
+%AUTOLOAD = (
+  fqdn     => 1,
+  fudge    => 1,
+  mxcheck  => 1,
+  tldcheck => 1,
+  local_rules => 1,
+);
+
 $NSLOOKUP_PAT = 'preference|serial|expire|mail\s+exchanger';
 @NSLOOKUP_PATHS = File::Spec->path();
 
@@ -24,7 +31,7 @@
   $class = ref $class || $class;
   bless my $self = {}, $class;
   $self->_initialize;
-  %$self = $self->_rearrange([qw( mxcheck tldcheck fudge fqdn local_rules )], \@_);
+  %$self = $self->_rearrange([ keys %AUTOLOAD ], \@_);
   return $self;
 }
 
@@ -49,7 +56,7 @@
   ref $self ? %args = %$self : _initialize( \%args );
   return %args unless @params;
   
-  unless ($params[0] =~ /^-/) {
+  unless ($params[0] =~ /^-/ and @params > 1) {
     while(@params) {
       croak 'unexpected number of parameters' unless @names;
       $args{ lc shift @names } = shift @params;
@@ -141,21 +148,34 @@
   return 1 if gethostbyname $host;
 
   # Check for an MX record
-  if (my $fh = new IO::File '-|') {
-    my $response = <$fh>;
+  if ($^O eq 'MSWin32' or $^O eq 'Cygwin') {
+    # Oh no, we're on Windows!
+    require IO::CaptureOutput;
+    my $response = IO::CaptureOutput::capture_exec(
+     $Nslookup_Path, '-query=mx', $host
+    );
+    croak "unable to execute nslookup '$Nslookup_Path': exit $?" if $?;
     print STDERR $response if $Debug;
-    close $fh;
     $response =~ /$NSLOOKUP_PAT/io or return $self->details('mx');
     return 1;
   } else {
-    open OLDERR, '>&STDERR' or croak "cannot dup stderr: $!";
-    open STDERR, '>&STDOUT' or croak "cannot redirect stderr to stdout: $!";
-    {
-      exec $Nslookup_Path, '-query=mx', $host;
-    }
-    open STDERR, ">&OLDERR";
-    croak "unable to execute nslookup '$Nslookup_Path': $!";
-  }                                                                             
+    # phew, we're not on Windows!
+    if (my $fh = new IO::File '-|') {
+      my $response = <$fh>;
+      print STDERR $response if $Debug;
+      close $fh;
+      $response =~ /$NSLOOKUP_PAT/io or return $self->details('mx');
+      return 1;
+    } else {
+      open OLDERR, '>&STDERR' or croak "cannot dup stderr: $!";
+      open STDERR, '>&STDOUT' or croak "cannot redirect stderr to stdout: $!";
+      {
+        exec $Nslookup_Path, '-query=mx', $host;
+      }
+      open STDERR, ">&OLDERR";
+      croak "unable to execute nslookup '$Nslookup_Path': $!";
+    }                                                                             
+  }
 }
 
 # Purpose: Check whether a top level domain is valid for a domain.
@@ -163,7 +183,7 @@
   my $self = shift;
   my %args = $self->_rearrange([qw( address )], \@_);
 
-  unless (eval { require Net::Domain::TLD; 1 }) {
+  unless (eval {require Net::Domain::TLD; Net::Domain::TLD->VERSION(1.65); 1}) {
     die "Net::Domain::TLD not available";
   }
 
@@ -255,9 +275,10 @@
   $addr = $addr->address if UNIVERSAL::isa($addr, 'Mail::Address');
 
   $addr = $self->_fudge( $addr ) if $args{fudge};
-  $self->rfc822( $addr ) or return undef;
+  $self->rfc822( -address => $addr ) or return undef;
 
   ($addr) = Mail::Address->parse( $addr );
+
   $addr or return $self->details('rfc822'); # This should never happen
 
   if ($args{local_rules}) {
@@ -270,11 +291,13 @@
   }
 
   if ($args{mxcheck}) {
-    $self->mx( $addr->host ) or return;
+    # I'm not sure this ->details call is needed, but I'll test for it later.
+    # The whole ->details thing is... weird. -- rjbs, 2006-06-08
+    $self->mx( $addr->host ) or return $self->details('mxcheck');
   }
 
   if ($args{tldcheck}) {
-    $self->tld( $addr->host ) or return;
+    $self->tld( $addr->host ) or return $self->details('tldcheck');
   }
 
   return (wantarray ? ($addr->address, $addr) : $addr->address);  

Modified: packages/libemail-valid-perl/trunk/t/valid.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-valid-perl/trunk/t/valid.t?rev=2955&op=diff
==============================================================================
--- packages/libemail-valid-perl/trunk/t/valid.t (original)
+++ packages/libemail-valid-perl/trunk/t/valid.t Mon Jun 12 22:17:39 2006
@@ -1,7 +1,7 @@
 #!perl
 use strict;
 
-use Test::More tests => 12;
+use Test::More tests => 16;
 
 BEGIN {
   use_ok('Email::Valid');
@@ -44,6 +44,21 @@
   "comments nicely dropped from an address",
 );
 
+ok(
+  $v->address('somebody@ example.com'),
+  "space between @ and domain is valid",
+);
+
+ok(
+  $v->address('-dashy at example.net'),
+  'an email can start with a dash',
+);
+
+ok(
+  $v->address(-address => '-dashy at example.net'),
+  'an email can start with a dash (alternate calling method)',
+);
+
 SKIP: {
   skip "Net::DNS not available or network down", 2
     unless eval { require Net::DNS; 1; } && Net::DNS::mx('debian.org');
@@ -63,16 +78,20 @@
 }
 
 SKIP: {
-  skip "tests require Net::Domain::TLD", 2
+  skip "tests require Net::Domain::TLD", 3
     unless eval { require Net::Domain::TLD; 1; };
 
+  my $v = Email::Valid->new;
+
   ok(
-    $v->address( -address => 'blort at notarealdomainfoo.com', -tldcheck => 1),
+    $v->address( -address => 'blort at notarealdomainfoo.com', -mxcheck => 0, -tldcheck => 1),
     'blort at notarealdomainfoo.com is ok with tldcheck',
   );
 
   ok(
-    ! $v->address( -address => 'blort at notarealdomainfoo.bla', -tldcheck => 1),
+    ! $v->address( -address => 'blort at notarealdomainfoo.bla', -mxcheck => 0, -tldcheck => 1),
     'blort at notarealdomainfoo.bla is not ok with tldcheck',
   );
+
+  is($v->details, 'tldcheck', "it was the tldcheck that broke this email");
 }




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