I have a script which uses Net::FTP to upload a backup file each night.  
It sends me an email each night if it succeeds and a different email if 
any of the methods fail.  This all works, but sometimes the ftp 
connection times out and my script hangs without sending anything.  

I don't know how to catch the timeout and send the failure message when 
that happens.

Here is basically what I have:
==
my $ftp = Net::FTP->new( "hostname", Debug => 1, Timeout => 240 )
  or send_fail(), die;

$ftp->login( "login info" ) or send_fail(), die;
$ftp->put( "filename" ) or send_fail(), die;
$ftp->quit or send_fail(), die;

$send_success;
==

Here is what my log says regarding the timeout:

==
Net::FTP=GLOB(0x96a486c)<<< 150 Ok to send data.
Uncaught exception from user code:
        Timeout at /usr/lib/perl5/5.8.5/Net/FTP.pm line 789
 at /usr/lib/perl5/5.8.5/Net/FTP/A.pm line 88


-- 
------------------------------------------------------------------------
Charles Farinella 
Appropriate Solutions, Inc. (www.AppropriateSolutions.com)
[EMAIL PROTECTED]
voice: 603.924.6079   fax: 603.924.8668


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to