This patch avoids several silly warnings, and fills $res->status_line with something useful in case your FTP server babbles some text message without a leading response code. Seen from ftp.opensuse.org: connect(3, {sa_family=AF_INET, sin_port=htons(21), sin_addr=inet_addr("195.135.221.134")}, 16) = 0 read(3, "This server is busy, please try again later or any of my mirrors: http://download.opensuse.org\n\n", 1024) = 96 Note the missing "500 " before "This". Command line ftp clients handle this gracefully, so should we. With this patch, LWP clients see a status_line of "500 This server is busy, ..." 2006-12-20, jw@suse.de --- lib/Net/FTP.pm.orig 2007-12-18 10:47:07.000000000 +0000 +++ lib/Net/FTP.pm 2008-01-07 10:08:30.000000000 +0000 @@ -107,7 +107,7 @@ sub new { unless ($ftp->response() == CMD_OK) { $ftp->close(); - $@ = $ftp->message; + $@ = $ftp->message || $@; # keep $@ if no message. Happens when response did not start with a code. undef $ftp; } @@ -1077,7 +1077,7 @@ sub command { sub response { my $ftp = shift; - my $code = $ftp->SUPER::response(); + my $code = $ftp->SUPER::response() || CMD_ERROR; # assume error if undef delete ${*$ftp}{'net_ftp_pasv'} if ($code != CMD_MORE && $code != CMD_INFO); @@ -1094,7 +1094,7 @@ sub parse_response { # Darn MS FTP server is a load of CRAP !!!! return () - unless ${*$ftp}{'net_cmd_code'} + 0; + unless (${*$ftp}{'net_cmd_code'} || 0) + 0; (${*$ftp}{'net_cmd_code'}, 1); } --- lib/Net/Cmd.pm.orig 2007-12-18 10:47:07.000000000 +0000 +++ lib/Net/Cmd.pm 2008-01-07 10:09:34.000000000 +0000 @@ -353,6 +353,7 @@ sub response { ($code, $more) = $cmd->parse_response($str); unless (defined $code) { $cmd->ungetline($str); + $@ = $str; # $@ is used as a tunneling hack. last; } @@ -363,6 +364,7 @@ sub response { last unless ($more); } + return undef unless defined $code; substr($code, 0, 1); }