about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>1999-03-16 21:08:02 +0000
committerGraham Barr <gbarr@pobox.com>1999-03-16 21:08:02 +0000
commit90f178622a6bf5e9362f996716ad1a551a8338c3 (patch)
tree3bac22a2a2e2f4da82d529c2828ff1915f7bc226
parent421087e52957580161ce448388ec0df056abf425 (diff)
downloadperl-libnet-90f178622a6bf5e9362f996716ad1a551a8338c3.tar.gz
Net::FTP
- new should only call authorize if there is user/passwd data

Net::SMTP
- Allow ->to to ignore bad addresses

-rw-r--r--Makefile.PL11
-rw-r--r--Net/FTP.pm21
-rw-r--r--Net/SMTP.pm33
3 files changed, 40 insertions, 25 deletions
diff --git a/Makefile.PL b/Makefile.PL
index 7d7f0a0..76016ae 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -85,21 +85,10 @@ chk_version(IO::Socket => '1.05') or
 
 #--- Write the Makefile
 
-my @clean = qw(*% *.html *.b[ac]k *.old *.orig *.rej);
-
-push @clean, map { "*/$_" } @clean;
-
 WriteMakefile(
         VERSION   => $VERSION,
         DISTNAME  => $DISTNAME,
         NAME      => $NAME,
-
-        'dist'    => {COMPRESS => 'gzip -9f',
-                      SUFFIX   => '.gz',
-                      DIST_DEFAULT => 'all tardist',
-                     },
-
-        'clean'   => {FILES => join(" ", @clean,  )},
         'realclean'   => {FILES => $config_pm},
         PREREQ_PM => {
                         Socket => 1.3,
diff --git a/Net/FTP.pm b/Net/FTP.pm
index f79951a..959376a 100644
--- a/Net/FTP.pm
+++ b/Net/FTP.pm
@@ -21,7 +21,7 @@ use Net::Cmd;
 use Net::Config;
 # use AutoLoader qw(AUTOLOAD);
 
-$VERSION = "2.50"; # $Id: //depot/libnet/Net/FTP.pm#35 $
+$VERSION = "2.51"; # $Id: //depot/libnet/Net/FTP.pm#36 $
 @ISA     = qw(Exporter Net::Cmd IO::Socket::INET);
 
 # Someday I will "use constant", when I am not bothered to much about
@@ -243,8 +243,10 @@ sub login
  $ok = $ftp->_ACCT($acct)
         if (defined($acct) && ($ok == CMD_MORE || $ok == CMD_OK));
 
- $ftp->authorize()
-    if($ok == CMD_OK && defined ${*$ftp}{'net_ftp_firewall'});
+ if($ok == CMD_OK && defined ${*$ftp}{'net_ftp_firewall'}) {
+   my($f,$auth,$resp) = _auth_id($ftp);
+   $ftp->authorize($auth,$resp) if defined($resp);
+ }
 
  $ok == CMD_OK;
 }
@@ -257,10 +259,7 @@ sub account
  $ftp->_ACCT($acct) == CMD_OK;
 }
 
-sub authorize
-{
- @_ >= 1 || @_ <= 3 or croak 'usage: $ftp->authorize( [AUTH [, RESP]])';
-
+sub _auth_id {
  my($ftp,$auth,$resp) = @_;
 
  unless(defined $resp)
@@ -275,6 +274,14 @@ sub authorize
    ($auth,$resp) = $rc->lpa()
      if($rc);
   }
+  ($ftp,$auth,$resp);
+}
+
+sub authorize
+{
+ @_ >= 1 || @_ <= 3 or croak 'usage: $ftp->authorize( [AUTH [, RESP]])';
+
+ my($ftp,$auth,$resp) = &_auth_id;
 
  my $ok = $ftp->_AUTH($auth || "");
 
diff --git a/Net/SMTP.pm b/Net/SMTP.pm
index 52f699e..6c44852 100644
--- a/Net/SMTP.pm
+++ b/Net/SMTP.pm
@@ -16,7 +16,7 @@ use IO::Socket;
 use Net::Cmd;
 use Net::Config;
 
-$VERSION = "2.14"; # $Id: //depot/libnet/Net/SMTP.pm#10 $
+$VERSION = "2.15"; # $Id: //depot/libnet/Net/SMTP.pm#11 $
 
 @ISA = qw(Net::Cmd IO::Socket::INET);
 
@@ -256,14 +256,16 @@ sub reset
 sub recipient
 {
  my $smtp = shift;
- my $ok = 1;
  my $opts = "";
+ my $skip_bad = 0;
 
  if(@_ && ref($_[-1]))
   {
    my %opt = %{pop(@_)};
    my $v;
 
+   $skip_bad = delete $opt{'SkipBad'};
+
    if(exists ${*$smtp}{'net_smtp_esmtp'})
     {
      my $esmtp = ${*$smtp}{'net_smtp_esmtp'};
@@ -285,18 +287,25 @@ sub recipient
                 . ' - ignored'
         if scalar keys %opt;
     }
-   else
+   elsif(%opt)
     {
      carp 'Net::SMTP::recipient: ESMTP not supported by host - options discarded :-(';
     }
   }
 
- while($ok && scalar(@_))
+ my @ok;
+ my $addr;
+ foreach $addr (@_)
   {
-   $ok = $smtp->_RCPT("TO:" . _addr(shift) . $opts);
+    if($smtp->_RCPT("TO:" . _addr($addr) . $opts)) {
+      push(@ok,$addr) if $skip_bad;
+    }
+    elsif(!$skip_bad) {
+      return 0;
+    }
   }
 
- return $ok;
+ return $skip_bad ? @ok : 1;
 }
 
 sub to { shift->recipient(@_) }
@@ -517,7 +526,7 @@ Reset the status of the server. This may be called after a message has been
 initiated, but before any data has been sent, to cancel the sending of the
 message.
 
-=item recipient ( ADDRESS [, ADDRESS [ ...]] )
+=item recipient ( ADDRESS [, ADDRESS [ ...]] [, OPTIONS ] )
 
 Notify the server that the current message should be sent to all of the
 addresses given. Each address is sent as a separate command to the server.
@@ -525,6 +534,16 @@ Should the sending of any address result in a failure then the
 process is aborted and a I<false> value is returned. It is up to the
 user to call C<reset> if they so desire.
 
+The C<recipient> method can some additional OPTIONS which is passed
+in hash like fashion, using key and value pairs.  Possible options are:
+
+ Notify    =>
+ SkipBad   => ignore bad addresses
+
+If C<SkipBad> is true the C<recipient> will not return an error when a
+bad address is encountered and it will return an array of addresses
+that did succeed.
+
 =item to ( ADDRESS [, ADDRESS [...]] )
 
 A synonym for C<recipient>.