theshoe has asked for the wisdom of the Perl Monks concerning the following question:

I am a real novice at Perl and am having trouble finding examples or books on utilizing the warn function with my script. Currently when a site is down the script dies thus ftps to other sites are not done. Would appreciate it if someone could lead me to the promised land before the boss takes another bite out of me. The shoe.

Replies are listed 'Best First'.
Re: Net:::FTP and the warn function
by lhoward (Vicar) on Jul 19, 2000 at 19:25 UTC
    You can also use Net::FTP built-in error reporting mechanisms: $ftp->ok(), $ftp->message(), $ftp->code(). All of those methods refer to the status of the last $ftp call that was made. (see Net::Cmd for info on the ok, message, and code methods that are common to most Net:: modules).
    $ftp->some_command(); if($ftp->code()==425){ # handle a "Can't open data connection." type error } #etc...
    The FTP error codes are detailed in RFC 959.
Re: Net:::FTP and the warn function
by jlistf (Monk) on Jul 19, 2000 at 19:12 UTC
    do you want something like this:
    $ftp->command() #or whatever you're doing here or warn "can't complete command : $!\n";
    or are you asking for something else. a little code might help.