about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>1998-06-19 04:54:46 +0000
committerGraham Barr <gbarr@pobox.com>1998-06-19 04:54:46 +0000
commitc20dd2ed85af6ed295a7d4e7e0cf053f2137005d (patch)
tree7d21b4c2d0ecbe4fc1ac0299aa452c8f272e323e
parent0606f44bb1fb19229ed4bd99b4c8d9256ba0aee7 (diff)
downloadperl-libnet-c20dd2ed85af6ed295a7d4e7e0cf053f2137005d.tar.gz
Net::FTP
- Tweak to ->supported() to better detect reports from some
  servers (NcFTPd)

-rw-r--r--Net/FTP.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/Net/FTP.pm b/Net/FTP.pm
index 2086a4d..32733af 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.41"; # $Id: //depot/libnet/Net/FTP.pm#26 $
+$VERSION = "2.42"; # $Id: //depot/libnet/Net/FTP.pm#27 $
 @ISA     = qw(Exporter Net::Cmd IO::Socket::INET);
 
 # Someday I will "use constant", when I am not bothered to much about
@@ -633,10 +633,19 @@ sub supported {
     return $hash->{$cmd}
         if exists $hash->{$cmd};
 
-    my $ok = $ftp->_HELP($cmd) &&
-        $ftp->message !~ /unimplemented/i;
+    return $hash->{$cmd} = 0
+        unless $ftp->_HELP($cmd);
 
-    $hash->{$cmd} = $ok;
+    my $text = $ftp->message;
+    if($text =~ /following\s+commands/i) {
+        $text =~ s/.*\n//;
+        $text =~ s/\n/ /sog;
+        while($text =~ /(\w+)([* ])/g) {
+            $hash->{"\U$1"} = $2 eq " " ? 1 : 0;
+        }
+    }
+
+    $hash->{$cmd} ||= 0;
 }
 
 ##