Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Problem while FTP

by converter (Priest)
on Oct 27, 2002 at 14:18 UTC ( #208342=note: print w/replies, xml ) Need Help??

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://208342]
and the fire pops...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2017-05-28 02:13 GMT
Find Nodes?
    Voting Booth?