http://www.perlmonks.org?node_id=208342


in reply to Problem while FTP

Net::FTP inherits from Net::Cmd. As with any module that inherits from other modules, it's a good idea to check the documentation for all base class modules (the modules listed in the @ISA array, if there is one) when you're learning how to use a particular module. Perl uses the modules listed in @ISA to find methods that are invoked against an object of a particular class when those methods aren't found in the object's class.

Looking at line 26 of Net::FTP (v. 2.62), we see that Net::FTP inherits methods from Exporter, Net::Cmd, and IO::Socket::INET. There's probably not much of interest in the Exporter documentation, but Net::Cmd's documentation lists a method called message that:

Returns the text message returned from the last command

You should be able retrieve the server response for all of the commands you're sending to the server with methods invoked against your $ftp object like so:

open LOG, ">> $LOGFile" or die "IO error opening $LOGFile for append: +$!"; ... $ftp->get($filename); print LOG "[get $filename] server response: ", $ftp->response || 'no r +esponse', "\n";

I hope that helps.