[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Net:FTP hanging my perl program



I have a perl program that scans various directories and uploads any files
it finds.  Occassionally, the program seems to fail when I try to close the
connection using quit();

Below is a snippet of code.  The output I get in both the logfile and the
console window indicates that it's the quit that's failing.  I get the
"Timed out!!!" message, and nothing after that.  And the code doesn't
continue.

Am I handling alarms correctly here?

John


sub catch_timeout
{
	print "Timed out!!!\n";
	$timedout = 1;
}

....

print LOGFILE "Successfully uploaded \"$thisfile\" to $rightserver at
$hour:$min:$sec\n";
alarm 30;
$ftp->quit();
alarm 0;
if ($timedout)
{
	$timedout = 0;
	print "Failed to close FTP connection in 30 seconds.  Moving on!!\n";
	print LOGFILE "Failed to close FTP connection in 30 seconds!!!\n";
	print LOGFILE "==========================================\n";
}
$SIG{ALRM} = \&catch_timeout;
print "------------------------------------------\n";
print LOGFILE "------------------------------------------\n";



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch