This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade libnet from 1.22 to 1.22_02
authorSteve Hay <steve.m.hay@googlemail.com>
Thu, 8 Aug 2013 20:21:42 +0000 (21:21 +0100)
committerSteve Hay <steve.m.hay@googlemail.com>
Thu, 8 Aug 2013 20:21:42 +0000 (21:21 +0100)
This is the latest (development) release on CPAN. It will shortly be
superseded by 1.23.

Note that Makefile.PL is only customized -- not excluded as well! Two
customized test files (actually, one changed and one added) which blead
had (but were not noted in the Maintainers.pl file!) are incorporated in
this release.

Also, change the UPSTREAM status from undef to 'blead' to reflect the fact
that GBARR is no longer actively maintaining libnet and for the immediate
future new CPAN releases are only likely to be rolled to keep in sync with
changes in blead, plus occasional simple patches from the CPAN RT queue.

18 files changed:
Porting/Maintainers.pl
cpan/libnet/Changes
cpan/libnet/Makefile.PL
cpan/libnet/Net/Cmd.pm
cpan/libnet/Net/Config.pm
cpan/libnet/Net/Domain.pm
cpan/libnet/Net/FTP.pm
cpan/libnet/Net/FTP/dataconn.pm
cpan/libnet/Net/NNTP.pm
cpan/libnet/Net/Netrc.pm
cpan/libnet/Net/POP3.pm
cpan/libnet/Net/SMTP.pm
cpan/libnet/Net/libnetFAQ.pod
cpan/libnet/README
cpan/libnet/t/ftp.t
cpan/libnet/t/netrc.t
pod/perldelta.pod
t/porting/customized.dat

index 82ab7af..4de45d4 100755 (executable)
@@ -1045,16 +1045,15 @@ use File::Glob qw(:case);
 
     'libnet' => {
         'MAINTAINER'   => 'gbarr',
-        'DISTRIBUTION' => 'GBARR/libnet-1.22.tar.gz',
+        'DISTRIBUTION' => 'SHAY/libnet-1.22_02.tar.gz',
         'FILES'        => q[cpan/libnet],
         'EXCLUDED'     => [
             qw( Configure
                 install-nomake
-                Makefile.PL
                 ),
         ],
         'CUSTOMIZED' => ['Makefile.PL'],
-        'UPSTREAM'   => undef,
+        'UPSTREAM'   => 'blead',
     },
 
     'Locale-Codes' => {
index ff26b1d..f957369 100644 (file)
@@ -1,3 +1,40 @@
+libnet 1.22_02 -- Thu Aug 08 2013
+
+  * Make Net::FTP::dataconn::close() more robust [Together with changes to
+    Net::FTP already made in 1.22_01, this resolves CPAN RT#37700]
+  * Document scalar/list context return values from Net::Cmd::message()
+  * Fix broken URL [Resolves CPAN RT#68749]
+  * Fix documentation typo in Net::Netrc
+  * Fix broken POD in Net::POP3
+  * Improve Net::SMTP documentation of new(), auth() and message() [Resolves
+    CPAN RT#36038]
+  * Add proper skips to skipped tests in ftp.t
+  * Import hostname.t fix from perl core commit #adeb94125a
+  * Add time.t, imported from perl core commit #c85707204c
+  * Add new maintainer information, with updated CPAN and GitHub links
+
+libnet 1.22_01 -- Mon May 31 09:40:25 CDT 2010
+
+  * Do not create/pass a remote name if one is not given to put_unique
+  * Add ->passive method to switch between PORT/PASV connections
+  * Accept - in command parsed from SMTP HELO response
+  * Allow group to set to a group named "0"
+  * Set $@ when ->new returns undef
+  * Add support for LocalAddr to be passed to ->new
+  * Document that timeout is in seconds
+  * Fix leading . encoding in datasend
+  * Make ->supported check ->feature
+  * Allow words other than FILE to prefix the unique name returned in info message from stou
+  * Send ALLO command just before the store command
+  * Avoid warnings when server do not prefix messages with codes
+  * Use uppercase characters for xtext encoding
+  * Catch timeout condition while doing an abort
+  * Ensure REST is sent directly before command being restarted
+  * [rt.cpan.org #49920] Fix URL [Leon Brocard]
+  * Avoid long hang on Mac OS X when hostname is *.local by not calling gethostbyname [Father Chrysostomos]
+  * Avoid infinite recursion in rmdir
+  * Allow finding _netrc on machines that do not support .netrc [Ben Bimber]
+
 libnet 1.22  -- Sun Aug 26 07:13:18 CDT 2007
 
 Bug Fixes
index 92c7d5f..afc7267 100644 (file)
@@ -4,7 +4,7 @@ use ExtUtils::MakeMaker;
 WriteMakefile (
     NAME            => 'Net',
     DISTNAME        => 'libnet',
-    VERSION         => '1.22', # finds $VERSION
+    VERSION         => '1.22_02', # finds $VERSION
     AUTHOR          => 'Graham Barr <gbarr@pobox.com>',
     ABSTRACT        => 'Collection of Network protocol modules',
 );
index 4f0e444..b4988b4 100644 (file)
@@ -37,7 +37,7 @@ BEGIN {
   }
 }
 
-$VERSION = "2.29";
+$VERSION = "2.29_2";
 @ISA     = qw(Exporter);
 @EXPORT  = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING);
 
@@ -353,6 +353,7 @@ sub response {
     ($code, $more) = $cmd->parse_response($str);
     unless (defined $code) {
       $cmd->ungetline($str);
+      $@ = $str;   # $@ used as tunneling hack
       last;
     }
 
@@ -363,6 +364,7 @@ sub response {
     last unless ($more);
   }
 
+  return undef unless defined $code;
   substr($code, 0, 1);
 }
 
@@ -406,6 +408,8 @@ sub datasend {
   return 0 unless defined(fileno($cmd));
 
   my $last_ch = ${*$cmd}{'net_cmd_last_ch'};
+
+  # We have not send anything yet, so last_ch = "\012" means we are at the start of a line
   $last_ch = ${*$cmd}{'net_cmd_last_ch'} = "\012" unless defined $last_ch;
 
   return 1 unless length $line;
@@ -421,9 +425,13 @@ sub datasend {
   my $first_ch = '';
 
   if ($last_ch eq "\015") {
-    $first_ch = "\012" if $line =~ s/^\012//;
+    # Remove \012 so it does not get prefixed with another \015 below
+    # and escape the . if there is one following it because the fixup
+    # below will not find it
+    $first_ch = "\012" if $line =~ s/^\012(\.?)/$1$1/;
   }
   elsif ($last_ch eq "\012") {
+    # Fixup below will not find the . as the first character of the buffer
     $first_ch = "." if $line =~ /^\./;
   }
 
@@ -649,7 +657,9 @@ debug level for a given class.
 
 =item message ()
 
-Returns the text message returned from the last command
+Returns the text message returned from the last command. In a scalar
+context it returns a single string, in a list context it will return
+each line as a separate element
 
 =item code ()
 
index db51c1f..24ae2c0 100644 (file)
@@ -13,7 +13,7 @@ use strict;
 
 @EXPORT  = qw(%NetConfig);
 @ISA     = qw(Net::LocalCfg Exporter);
-$VERSION = "1.11";
+$VERSION = "1.11_01";
 
 eval { local $SIG{__DIE__}; require Net::LocalCfg };
 
@@ -274,7 +274,7 @@ FTP servers can work in passive or active mode. Active mode is when
 you want to transfer data you have to tell the server the address and
 port to connect to.  Passive mode is when the server provide the
 address and port and you establish the connection.
+
 With some firewalls active mode does not work as the server cannot
 connect to your machine (because you are behind a firewall) and the firewall
 does not re-write the command. In this case you should set C<ftp_ext_passive>
index 330909d..017cc92 100644 (file)
@@ -16,7 +16,7 @@ use Net::Config;
 @ISA       = qw(Exporter);
 @EXPORT_OK = qw(hostname hostdomain hostfqdn domainname);
 
-$VERSION = "2.20";
+$VERSION = "2.21";
 
 my ($host, $domain, $fqdn) = (undef, undef, undef);
 
@@ -222,6 +222,13 @@ sub domainname {
     if (defined $fqdn);
 
   _hostname();
+
+  # *.local names are special on darwin. If we call gethostbyname below, it
+  # may hang while waiting for another, non-existent computer to respond.
+  if($^O eq 'darwin' && $host =~ /\.local$/) {
+    return $host;
+  }
+
   _hostdomain();
 
   # Assumption: If the host name does not contain a period
index 9ed6d38..1c0deb2 100644 (file)
@@ -21,7 +21,7 @@ use Net::Cmd;
 use Net::Config;
 use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC);
 
-$VERSION = '2.77';
+$VERSION = '2.77_3';
 @ISA     = qw(Exporter Net::Cmd IO::Socket::INET);
 
 # Someday I will "use constant", when I am not bothered to much about
@@ -107,7 +107,8 @@ sub new {
 
   unless ($ftp->response() == CMD_OK) {
     $ftp->close();
-    $@ = $ftp->message;
+    # keep @$ if no message. Happens, when response did not start with a code.
+    $@ = $ftp->message || $@;
     undef $ftp;
   }
 
@@ -124,6 +125,12 @@ sub host {
   ${*$me}{'net_ftp_host'};
 }
 
+sub passive {
+  my $ftp = shift;
+  return ${*$ftp}{'net_ftp_passive'} unless @_;
+  ${*$ftp}{'net_ftp_passive'} = shift;
+}
+
 
 sub hash {
   my $ftp = shift;    # self
@@ -583,6 +590,9 @@ sub rmdir {
   return undef
     unless @filelist;    # failed, it is probably not a directory
 
+  return $ftp->delete($dir)
+    if @filelist == 1 and $dir eq $filelist[0];
+
   # Go thru and delete each file or the directory
   my $file;
   foreach $file (map { m,/, ? $_ : "$dir/$_" } @filelist) {
@@ -688,7 +698,7 @@ sub _store_cmd {
 
   my $localfd = ref($local) || ref(\$local) eq "GLOB";
 
-  unless (defined $remote) {
+  if (!defined($remote) and 'STOU' ne uc($cmd)) {
     croak 'Must specify remote filename with stream input'
       if $localfd;
 
@@ -705,10 +715,10 @@ sub _store_cmd {
     # a pipe, or device) and if so get the file size from stat, and send
     # an ALLO command before sending the STOR, STOU, or APPE command.
     my $size = do { local $^W; -f $local && -s _ };    # no ALLO if sending data from a pipe
-    $ftp->_ALLO($size) if $size;
+    ${*$ftp}{'net_ftp_allo'} = $size if $size;
   }
   croak("Bad remote filename '$remote'\n")
-    if $remote =~ /[\r\n]/s;
+    if defined($remote) and $remote =~ /[\r\n]/s;
 
   if ($localfd) {
     $loc = $local;
@@ -730,10 +740,10 @@ sub _store_cmd {
   delete ${*$ftp}{'net_ftp_port'};
   delete ${*$ftp}{'net_ftp_pasv'};
 
-  $sock = $ftp->_data_cmd($cmd, $remote)
+  $sock = $ftp->_data_cmd($cmd, grep { defined } $remote)
     or return undef;
 
-  $remote = ($ftp->message =~ /FILE:\s*(.*)/)[0]
+  $remote = ($ftp->message =~ /\w+\s*:\s*(.*)/)[0]
     if 'STOU' eq uc $cmd;
 
   my $blksize = ${*$ftp}{'net_ftp_blksize'};
@@ -852,6 +862,9 @@ sub supported {
   return $hash->{$cmd}
     if exists $hash->{$cmd};
 
+  return $hash->{$cmd} = 1
+    if $ftp->feature($cmd);
+
   return $hash->{$cmd} = 0
     unless $ftp->_HELP($cmd);
 
@@ -1005,22 +1018,24 @@ sub _data_cmd {
   {
     my $data = undef;
 
-    $ok = defined $ftp->pasv;
-    $ok = $ftp->_REST($where)
-      if $ok && $where;
-
-    if ($ok) {
-      $ftp->command($cmd, @_);
-      $data = $ftp->_dataconn();
-      $ok   = CMD_INFO == $ftp->response();
-      if ($ok) {
-        $data->reading
-          if $data && $cmd =~ /RETR|LIST|NLST/;
-        return $data;
-      }
-      $data->_close
-        if $data;
+    return undef unless defined $ftp->pasv;
+    $data = $ftp->_dataconn() or return undef;
+
+    if ($where and !$ftp->_REST($where)) {
+      my ($status, $message) = ($ftp->status, $ftp->message);
+      $ftp->abort;
+      $ftp->set_status($status, $message);
+      return undef;
     }
+
+    $ftp->command($cmd, @_);
+    if (CMD_INFO == $ftp->response()) {
+      $data->reading
+        if $cmd =~ /RETR|LIST|NLST/;
+      return $data;
+    }
+    $data->_close;
+
     return undef;
   }
 
@@ -1034,6 +1049,11 @@ sub _data_cmd {
   return undef
     unless $ok;
 
+  if ($cmd =~ /(STOR|APPE|STOU)/ and exists ${*$ftp}{net_ftp_allo}) {
+    $ftp->_ALLO(delete ${*$ftp}{net_ftp_allo})
+      or return undef;
+  }
+
   $ftp->command($cmd, @_);
 
   return 1
@@ -1077,7 +1097,7 @@ sub command {
 
 sub response {
   my $ftp  = shift;
-  my $code = $ftp->SUPER::response();
+  my $code = $ftp->SUPER::response() || 5;    # assume 500 if undef
 
   delete ${*$ftp}{'net_ftp_pasv'}
     if ($code != CMD_MORE && $code != CMD_INFO);
@@ -1093,8 +1113,9 @@ sub parse_response {
   my $ftp = shift;
 
   # Darn MS FTP server is a load of CRAP !!!!
+  # Expect to see undef here.
   return ()
-    unless ${*$ftp}{'net_cmd_code'} + 0;
+    unless 0 + (${*$ftp}{'net_cmd_code'} || 0);
 
   (${*$ftp}{'net_cmd_code'}, 1);
 }
@@ -1344,7 +1365,7 @@ transfers. (defaults to 10240)
 B<Port> - The port number to connect to on the remote machine for the
 FTP connection
 
-B<Timeout> - Set a timeout value (defaults to 120)
+B<Timeout> - Set a timeout value in seconds (defaults to 120)
 
 B<Debug> - debug level (see the debug method in L<Net::Cmd>)
 
@@ -1439,6 +1460,10 @@ to change the directory to the root directory.
 
 Change directory to the parent of the current directory.
 
+=item passive ( [ PASSIVE ] )
+
+Set or get if data connections will be initiated in passive mode.
+
 =item pwd ()
 
 Returns the full pathname of the current directory.
@@ -1796,7 +1821,7 @@ L<Net::Netrc>
 L<Net::Cmd>
 
 ftp(1), ftpd(8), RFC 959
-http://www.cis.ohio-state.edu/htbin/rfc/rfc959.html
+http://www.ietf.org/rfc/rfc959.txt
 
 =head1 USE EXAMPLES
 
index e7645cb..64eaeec 100644 (file)
@@ -9,7 +9,7 @@ use vars qw(@ISA $timeout $VERSION);
 use Net::Cmd;
 use Errno;
 
-$VERSION = '0.11';
+$VERSION = '0.11_02';
 @ISA     = qw(IO::Socket::INET);
 
 
@@ -52,7 +52,8 @@ sub _close {
   $data->SUPER::close();
 
   delete ${*$ftp}{'net_ftp_dataconn'}
-    if exists ${*$ftp}{'net_ftp_dataconn'}
+    if defined $ftp
+    && exists ${*$ftp}{'net_ftp_dataconn'}
     && $data == ${*$ftp}{'net_ftp_dataconn'};
 }
 
@@ -63,12 +64,14 @@ sub close {
 
   if (exists ${*$data}{'net_ftp_bytesread'} && !${*$data}{'net_ftp_eof'}) {
     my $junk;
-    $data->read($junk, 1, 0);
+    eval { local($SIG{__DIE__}); $data->read($junk, 1, 0) };
     return $data->abort unless ${*$data}{'net_ftp_eof'};
   }
 
   $data->_close;
 
+  return unless defined $ftp;
+
   $ftp->response() == CMD_OK
     && $ftp->message =~ /unique file name:\s*(\S*)\s*\)/
     && (${*$ftp}{'net_ftp_unique'} = $1);
index a742aed..a9a5592 100644 (file)
@@ -14,7 +14,7 @@ use Carp;
 use Time::Local;
 use Net::Config;
 
-$VERSION = "2.24";
+$VERSION = "2.24_1";
 @ISA     = qw(Net::Cmd IO::Socket::INET);
 
 
@@ -39,23 +39,24 @@ sub new {
   @{$hosts} = qw(news)
     unless @{$hosts};
 
+  my %connect = ( Proto => 'tcp');
+  my $o;
+  foreach $o (qw(LocalAddr Timeout)) {
+    $connect{$o} = $arg{$o} if exists $arg{$o};
+  }
+  $connect{Timeout} = 120 unless defined $connect{Timeout};
+  $connect{PeerPort} = $arg{Port} || 'nntp(119)';
   my $h;
   foreach $h (@{$hosts}) {
-    $obj = $type->SUPER::new(
-      PeerAddr => ($host = $h),
-      PeerPort => $arg{Port} || 'nntp(119)',
-      Proto => 'tcp',
-      Timeout => defined $arg{Timeout}
-      ? $arg{Timeout}
-      : 120
-      )
+    $connect{PeerAddr} = $h;
+    $obj = $type->SUPER::new(%connect)
       and last;
   }
 
   return undef
     unless defined $obj;
 
-  ${*$obj}{'net_nntp_host'} = $host;
+  ${*$obj}{'net_nntp_host'} = $connect{PeerAddr};
 
   $obj->autoflush(1);
   $obj->debug(exists $arg{Debug} ? $arg{Debug} : undef);
@@ -213,16 +214,18 @@ sub nntpstat {
 sub group {
   @_ == 1 || @_ == 2 or croak 'usage: $nntp->group( [ GROUP ] )';
   my $nntp = shift;
-  my $grp  = ${*$nntp}{'net_nntp_group'} || undef;
+  my $grp  = ${*$nntp}{'net_nntp_group'};
 
   return $grp
     unless (@_ || wantarray);
 
   my $newgrp = shift;
 
-  return wantarray ? () : undef
-    unless $nntp->_GROUP($newgrp || $grp || "")
-    && $nntp->message =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\S+)/;
+  $newgrp = (defined($grp) and length($grp)) ? $grp : ""
+    unless defined($newgrp) and length($newgrp);
+
+  return 
+    unless $nntp->_GROUP($newgrp) and $nntp->message =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\S+)/;
 
   my ($count, $first, $last, $group) = ($1, $2, $3, $4);
 
@@ -747,6 +750,11 @@ so that the remote server becomes innd. If the C<Reader> option is given
 with a value of zero, then this command will not be sent and the
 connection will be left talking to nnrpd.
 
+B<LocalAddr> - If multiple IP addresses are present on the client host
+with a valid route to the destination, you can specify the address your
+C<Net::NNTP> connects from and this way override the operating system's
+pick.
+
 =back
 
 =head1 METHODS
index 28c826b..7d153a2 100644 (file)
@@ -9,9 +9,9 @@ package Net::Netrc;
 use Carp;
 use strict;
 use FileHandle;
-use vars qw($VERSION);
+use vars qw($VERSION $TESTING);
 
-$VERSION = "2.12";
+$VERSION = "2.13_01";
 
 my %netrc = ();
 
@@ -30,7 +30,15 @@ sub _readrc {
     # Some OS's don't have `getpwuid', so we default to $ENV{HOME}
     $home = eval { (getpwuid($>))[7] } || $ENV{HOME};
     $home ||= $ENV{HOMEDRIVE} . ($ENV{HOMEPATH} || '') if defined $ENV{HOMEDRIVE};
-    $file = $home . "/.netrc";
+    if (-e $home . "/.netrc") {
+      $file = $home . "/.netrc";
+    }
+    elsif (-e $home . "/_netrc") {
+      $file = $home . "/_netrc";
+    }
+    else {
+      return unless $TESTING;
+    }
   }
 
   my ($login, $pass, $acct) = (undef, undef, undef);
@@ -303,7 +311,7 @@ Return the account information for the netrc entry
 
 =item lpa ()
 
-Return a list of login, password and account information fir the netrc entry
+Return a list of login, password and account information for the netrc entry
 
 =back
 
index 8381c81..0d227fd 100644 (file)
@@ -13,7 +13,7 @@ use Net::Cmd;
 use Carp;
 use Net::Config;
 
-$VERSION = "2.29";
+$VERSION = "2.29_01";
 
 @ISA = qw(Net::Cmd IO::Socket::INET);
 
@@ -307,26 +307,22 @@ sub _get_mailbox_count {
 }
 
 
-sub _STAT { shift->command('STAT')->response() == CMD_OK }
-sub _LIST { shift->command('LIST', @_)->response() == CMD_OK }
+sub _STAT { shift->command('STAT'       )->response() == CMD_OK }
+sub _LIST { shift->command('LIST',    @_)->response() == CMD_OK }
 sub _RETR { shift->command('RETR', $_[0])->response() == CMD_OK }
 sub _DELE { shift->command('DELE', $_[0])->response() == CMD_OK }
-sub _NOOP { shift->command('NOOP')->response() == CMD_OK }
-sub _RSET { shift->command('RSET')->response() == CMD_OK }
-sub _QUIT { shift->command('QUIT')->response() == CMD_OK }
-sub _TOP  { shift->command('TOP', @_)->response() == CMD_OK }
-sub _UIDL { shift->command('UIDL', @_)->response() == CMD_OK }
+sub _NOOP { shift->command('NOOP'       )->response() == CMD_OK }
+sub _RSET { shift->command('RSET'       )->response() == CMD_OK }
+sub _QUIT { shift->command('QUIT'       )->response() == CMD_OK }
+sub _TOP  { shift->command( 'TOP',    @_)->response() == CMD_OK }
+sub _UIDL { shift->command('UIDL',    @_)->response() == CMD_OK }
 sub _USER { shift->command('USER', $_[0])->response() == CMD_OK }
 sub _PASS { shift->command('PASS', $_[0])->response() == CMD_OK }
-sub _APOP { shift->command('APOP', @_)->response() == CMD_OK }
+sub _APOP { shift->command('APOP',    @_)->response() == CMD_OK }
 sub _PING { shift->command('PING', $_[0])->response() == CMD_OK }
-
-
 sub _RPOP { shift->command('RPOP', $_[0])->response() == CMD_OK }
-sub _LAST { shift->command('LAST')->response() == CMD_OK }
-
-
-sub _CAPA { shift->command('CAPA')->response() == CMD_OK }
+sub _LAST { shift->command('LAST'       )->response() == CMD_OK }
+sub _CAPA { shift->command('CAPA'       )->response() == CMD_OK }
 
 
 sub quit {
@@ -565,7 +561,7 @@ on the object.
 
 =over 4
 
-=item new ( [ HOST ] [, OPTIONS ] 0
+=item new ( [ HOST ] [, OPTIONS ] )
 
 This is the constructor for a new Net::POP3 object. C<HOST> is the
 name of the remote host to which an POP3 connection is required.
index a28496d..67a7418 100644 (file)
@@ -16,7 +16,7 @@ use IO::Socket;
 use Net::Cmd;
 use Net::Config;
 
-$VERSION = "2.31";
+$VERSION = "2.31_2";
 
 @ISA = qw(Net::Cmd IO::Socket::INET);
 
@@ -59,7 +59,9 @@ sub new {
   $obj->debug(exists $arg{Debug} ? $arg{Debug} : undef);
 
   unless ($obj->response() == CMD_OK) {
+    my $err = ref($obj) . ": " . $obj->code . " " . $obj->message;
     $obj->close();
+    $@ = $err;
     return undef;
   }
 
@@ -70,7 +72,9 @@ sub new {
   (${*$obj}{'net_smtp_domain'}) = $obj->message =~ /\A\s*(\S+)/;
 
   unless ($obj->hello($arg{Hello} || "")) {
+    my $err = ref($obj) . ": " . $obj->code . " " . $obj->message;
     $obj->close();
+    $@ = $err;
     return undef;
   }
 
@@ -176,7 +180,7 @@ sub hello {
     my $ln;
     foreach $ln (@msg) {
       $h->{uc $1} = $2
-        if $ln =~ /(\w+)\b[= \t]*([^\n]*)/;
+        if $ln =~ /([-\w]+)\b[= \t]*([^\n]*)/;
     }
   }
   elsif ($me->status == CMD_ERROR) {
@@ -286,7 +290,7 @@ sub mail {
 
       if (defined($v = delete $opt{Envelope})) {
         if (exists $esmtp->{DSN}) {
-          $v =~ s/([^\041-\176]|=|\+)/sprintf "+%02x", ord($1)/sge;
+          $v =~ s/([^\041-\176]|=|\+)/sprintf "+%02X", ord($1)/sge;
           $opts .= " ENVID=$v";
         }
         else {
@@ -575,16 +579,18 @@ known as mailhost:
 
     use Net::SMTP;
 
-    $smtp = Net::SMTP->new('mailhost');
+    my $smtp = Net::SMTP->new('mailhost');
 
     $smtp->mail($ENV{USER});
-    $smtp->to('postmaster');
-
-    $smtp->data();
-    $smtp->datasend("To: postmaster\n");
-    $smtp->datasend("\n");
-    $smtp->datasend("A simple test message\n");
-    $smtp->dataend();
+    if ($smtp->to('postmaster')) {
+     $smtp->data();
+     $smtp->datasend("To: postmaster\n");
+     $smtp->datasend("\n");
+     $smtp->datasend("A simple test message\n");
+     $smtp->dataend();
+    } else {
+     print "Error: ", $smtp->message();
+    }
 
     $smtp->quit;
 
@@ -597,6 +603,9 @@ known as mailhost:
 This is the constructor for a new Net::SMTP object. C<HOST> is the
 name of the remote host to which an SMTP connection is required.
 
+On failure C<undef> will be returned and C<$@> will contain the reason
+for the failure.
+
 C<HOST> is optional. If C<HOST> is not given then it may instead be
 passed as the C<Host> option described below. If neither is given then
 the C<SMTP_Hosts> specified in C<Net::Config> will be used.
@@ -608,11 +617,14 @@ B<Hello> - SMTP requires that you identify yourself. This option
 specifies a string to pass as your mail domain. If not given localhost.localdomain
 will be used.
 
-B<Host> - SMTP host to connect to. It may be a single scalar, as defined for
-the C<PeerAddr> option in L<IO::Socket::INET>, or a reference to
+B<Host> - SMTP host to connect to. It may be a single scalar (hostname[:port]),
+as defined for the C<PeerAddr> option in L<IO::Socket::INET>, or a reference to
 an array with hosts to try in turn. The L</host> method will return the value
 which was used to connect to the host.
 
+B<Port> - port to connect to. Format - C<PeerHost> from L<IO::Socket::INET> new method.
+Default - 25.
+
 B<LocalAddr> and B<LocalPort> - These parameters are passed directly
 to IO::Socket to allow binding the socket to a local port.
 
@@ -688,7 +700,7 @@ Request a queue run for the DOMAIN given.
 
 =item auth ( USERNAME, PASSWORD )
 
-Attempt SASL authentication.
+Attempt SASL authentication. Requires Authen::SASL module.
 
 =item mail ( ADDRESS [, OPTIONS] )
 
@@ -768,7 +780,7 @@ that a DSN not be returned to the sender under any conditions."
   $smtp->recipient(@recipients, { Notify => ['NEVER'], SkipBad => 1 });  # Good
 
 You may use any combination of these three values 'SUCCESS','FAILURE','DELAY' in
-the anonymous array reference as defined by RFC3461 (see http://rfc.net/rfc3461.html
+the anonymous array reference as defined by RFC3461 (see http://www.ietf.org/rfc/rfc3461.txt
 for more information.  Note: quotations in this topic from same.).
 
 A Notify parameter of 'SUCCESS' or 'FAILURE' "requests that a DSN be issued on
@@ -824,6 +836,10 @@ Verify that C<ADDRESS> is a legitimate mailing address.
 Most sites usually disable this feature in their SMTP service configuration.
 Use "Debug => 1" option under new() to see if disabled.
 
+=item message ()
+
+Returns the text message returned from the last command. (Net::Cmd method)
+
 =item help ( [ $subject ] )
 
 Request help text from the server. Returns the text or undef upon failure
index e6ec362..b729f13 100644 (file)
@@ -9,12 +9,14 @@ libnetFAQ - libnet Frequently Asked Questions
 This document is distributed with the libnet distribution, and is also
 available on the libnet web page at
 
-    http://search.cpan.org/~gbarr/libnet/
+    http://search.cpan.org/dist/libnet/
 
 =head2 How to contribute to this document
 
-You may mail corrections, additions, and suggestions to me
-gbarr@pobox.com.
+You may report corrections, additions, and suggestions on the
+CPAN request tracker at
+
+    http://rt.cpan.org/Dist/Display.html?Name=libnet
 
 =head1 Author and Copyright Information
 
@@ -22,6 +24,8 @@ Copyright (c) 1997-1998 Graham Barr. All rights reserved.
 This document is free; you can redistribute it and/or modify it
 under the terms of the Artistic License.
 
+Currently maintained by Steve Hay <shay@cpan.org>.
+
 =head2 Disclaimer
 
 This information is offered in good faith and in the hope that it may
@@ -65,12 +69,7 @@ should not be the case with perl version 5.004 or later.
 The latest libnet release is always on CPAN, you will find it
 in 
 
- http://www.cpan.org/modules/by-module/Net/
-
-The latest release and information is also available on the libnet web page
-at
-
- http://search.cpan.org/~gbarr/libnet/
+ http://search.cpan.org/dist/libnet/
 
 =head1 Using Net::FTP
 
index 25b6c73..67a6846 100644 (file)
@@ -22,15 +22,15 @@ AVAILABILITY
 The latest version of libnet is available from the Comprehensive Perl
 Archive Network (CPAN). To find a CPAN site near you see:
 
-    http://search.cpan.org/~gbarr/libnet/
+    http://search.cpan.org/dist/libnet/
 
-The subversion source repository can be browsed at
+The GitHub source repository can be browsed at
 
-    http://svn.goingon.net/viewvc/libnet/
+    http://github.com/steve-m-hay/perl-libnet
 
-If you have a subversion client, then you can checkout the latest code with
+If you have a Git client, then you can checkout the latest code with
 
-  svn co http://svn.goingon.net/repos/libnet/trunk libnet
+    git clone http://github.com/steve-m-hay/perl-libnet.git
 
 INSTALLATION
 
@@ -93,7 +93,9 @@ SUPPORT
 
 Questions about how to use this library should be directed to the
 comp.lang.perl.modules USENET Newsgroup.  Bug reports and suggestions
-for improvements can be sent to me at <gbarr@pobox.com>. 
+for improvements can be reported on the CPAN request tracker at
+
+    http://rt.cpan.org/Dist/Display.html?Name=libnet
 
 Most of the modules in this library have an option to output a debug
 transcript to STDERR. When reporting bugs/problems please, if possible,
@@ -106,4 +108,6 @@ COPYRIGHT
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
+Currently maintained by Steve Hay <shay@cpan.org>.
+
 Share and Enjoy!
index 32d750e..dc690b6 100644 (file)
@@ -6,18 +6,23 @@ BEGIN {
        @INC = '../lib';
     }
     if (!eval "require Socket") {
-       print "1..0 # no Socket\n"; exit 0;
+       print "1..0 # Skip: no Socket module\n"; exit 0;
     }
     if (ord('A') == 193 && !eval "require Convert::EBCDIC") {
-        print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0;
+        print "1..0 # Skip: EBCDIC but no Convert::EBCDIC\n"; exit 0;
     }
 }
 
 use Net::Config;
 use Net::FTP;
 
-unless(defined($NetConfig{ftp_testhost}) && $NetConfig{test_hosts}) {
-    print "1..0\n";
+unless(defined($NetConfig{ftp_testhost})) {
+    print "1..0 # Skip: no ftp_testhost defined in config\n";
+    exit 0;
+}
+
+unless($NetConfig{test_hosts}) {
+    print "1..0 # Skip: test_hosts not enabled in config\n";
     exit 0;
 }
 
index cb5c35d..2a00956 100644 (file)
@@ -44,6 +44,7 @@ require $libnet_t;
 eval { require Net::Netrc; };
 ok( !$@, 'should be able to require() Net::Netrc safely' );
 ok( exists $INC{'Net/Netrc.pm'}, 'should be able to use Net::Netrc' );
+$Net::Netrc::TESTING=$Net::Netrc::TESTING=1;
 
 SKIP: {
        skip('incompatible stat() handling for OS', 4), next SKIP 
index 7745444..70da203 100644 (file)
@@ -169,6 +169,10 @@ needed and a regression introduced in 0.78 has been fixed.
 
 =item *
 
+The libnet module collection has been upgraded from version 1.22 to 1.22_02.
+
+=item *
+
 L<List::Util> has been upgraded from version 1.27 to 1.30
 
 L<List::Util> now includes C<pairgrep>, C<pairmap>, C<pairs>, C<pairkeys>,
index 024dc33..68b56d6 100644 (file)
@@ -11,6 +11,6 @@ Text::Balanced cpan/Text-Balanced/t/07_exttag.t 5a209ed156387d4614d3003292e5fc41
 Text::Balanced cpan/Text-Balanced/t/08_extvar.t 0776ef2cbdad5b1fbefb300541d079212cc24d92
 Text::Balanced cpan/Text-Balanced/t/09_gentag.t 42361b5dfb3bb728bce20f4fb0d92ccfb27c2ba7
 Time::HiRes cpan/Time-HiRes/Makefile.PL 178c13f9fef25520cc752581b86e5e4c05a5eade
-libnet cpan/libnet/Makefile.PL 5554b71464b45f5cc002e55f2464f7ff4abd05b6
+libnet cpan/libnet/Makefile.PL 1c5fb6a4a241902ecf3b10ec39d0a5606e796ffd
 podlators cpan/podlators/scripts/pod2man.PL f81acf53f3ff46cdcc5ebdd661c5d13eb35d20d6
 podlators cpan/podlators/scripts/pod2text.PL b4693fcfe4a0a1b38a215cfb8985a65d5d025d69