CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
sorry to bother you guys again... but HELP ME ??


Peter Van Hoecke

May 2, 2000, 12:24 AM

Post #1 of 2 (1022 views)
sorry to bother you guys again... but HELP ME ?? Can't Post

I have posted my question before, but I failed to define my problem correctly.

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 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) )
&#0124; &#0124; 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... Frown

Peter Van Hoecke

May 2, 2000, 6:11 AM

Post #2 of 2 (1022 views)
Re: sorry to bother you guys again... but HELP ME ?? [In reply to] Can't Post

this seems to do the trick... OK, it's ugly but it works!

BEGIN { $SIG{'__WARN__'} = sub { &printTime("$_"); } }


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives