diff options
author | Graham Barr <gbarr@pobox.com> | 1998-06-19 04:54:46 +0000 |
---|---|---|
committer | Graham Barr <gbarr@pobox.com> | 1998-06-19 04:54:46 +0000 |
commit | c20dd2ed85af6ed295a7d4e7e0cf053f2137005d (patch) | |
tree | 7d21b4c2d0ecbe4fc1ac0299aa452c8f272e323e | |
parent | 0606f44bb1fb19229ed4bd99b4c8d9256ba0aee7 (diff) | |
download | perl-libnet-c20dd2ed85af6ed295a7d4e7e0cf053f2137005d.tar.gz |
Net::FTP
- Tweak to ->supported() to better detect reports from some servers (NcFTPd)
-rw-r--r-- | Net/FTP.pm | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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; } ## |