I know what you feel, the same problems with Net::FTP was bothering me for quite a while. What solved it for me was checking all values in use - and wrapping the whole process in an eval.
The code below is a result of fixing things that has gone wrong over time, and now it doesn't crash my program anymore. It uses the Net::FTP default timeout of 10 minutes (if memory serves me right), which doesn't make the program die, and has evals and checks on the things that do make it die:
if ($ftp_address && $ftp_user && $ftp_password) {
eval {
my $ftp = Net::FTP->new($ftp_address, Passive => 1);
if ($ftp) {
$ftp->login($ftp_user,$ftp_password);
$ftp->cwd($ftp_directory) if $ftp_directory;
$ftp->put($ftp_filename);
$ftp->quit;
} else {
# FTP object no good
}
}; # Eval ends.
warn "error $@" if $@;
}
In reply to Re: Net::FTP problems
by matsmats
in thread Net::FTP problems
by panaman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |