Peter Van Hoecke
May 2, 2000, 12:24 AM
Post #1 of 2
I have posted my question before, but I failed to define my problem correctly.
sorry to bother you guys again... but HELP ME ??
I tried to write a script to connect to ftp servers and download certain files from them. Troubleshouting and errorhandling is an important factor for the succes of the script. I am using Net::FTP, and every method of Net::FTP returns a true/false statement to indicate succes or failure. Every method does this, except the constructor. This constructor returns undef and puts an error in $@. $@ contains the syntax error of the last eval command.
My script reacts correctly when the FTPserver is full or down, but I can't prevent Perl from writing a "Net::FTP: Unknown error at putstats.pl line 139
" line in my cmd box. This is not an essential problem, but I want it stopped!
Is there a way to prevent Perl from printing such a line?
I will summurize the problem:
If the FTP server is down, not non-existant, and "Net::FTP->new( $hostName, Port => $hostPort, Timeout => $timeoutSecs)" failed to reach the host, I get the error message.
I use | | to react to such a program, but I still get an irritating error message on the command prompt.
If you have the url for an FTP server that is down, you could theoretically test it with this statement, just fill in the data:
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>
($ftp = Net::FTP->new( $hostName, Port => $hostPort, Timeout => $timeoutSecs) )
| | print("Can not connect to <$hostName>: Host not reachable!\n" );
Please help me, I promise that I double my own effort to help other Perl scripters that post here...