in reply to Re^2: Net::FTP not catching errors, my fault?
in thread [solved] Net::FTP not catching errors, my fault?

As has been pointed out, if logwarn returns true, then all the ftp commands are going to be run regardless (as each condition checked by the and's are going to be true).

As you print the same log info each time, you could try something like the following, which avoids the constant line-noise log writing.

if ($ftp->login($data->{'login'}, $data->{'pw'}) and $ftp->binary and $ftp->cwd($data->{'remote_dir'}) and $ftp->put($to_upload) and $ftp->quit) { return 1; } else { $log->logwarn("upload_file: xqe $data->{'id'}, ", $ftp->message) $log->error("upload_file: xqe $data->{'id'}, " . "upload failed fo +r $to_upload"); return undef; }
---
my name's not Keith, and I'm not reasonable.