Found out that if an EOF error happens the command
returns 0, $ftp->code() returns 0, and $ftp->message()
returns "", so here's a way around it which I'm posting if
it'll help anyone else...
It returns 1000 on an EOF and the routine that calls it
thinks it's an unrecoverable FTP error as it's above 500
and quits.
Cheers.
sub ftp_move()
{
my $file=$_[0];
my $exempt=-1;
my $code;
$exempt=$_[0] if $_[0];
if(-e $rvf_incoming.$file.".done")
{
&write_log("+ [$file] already exists in incoming direc
+tory, skipping",0);
$files_skipped++;
return 0;
}
&write_log("+ [$file] interesting name, moving to incoming dir
+ectory.",0);
if($ftp->get($file,$rvf_incoming.$file))
{
# Don't bother about errors, may not have permission t
+o delete.
### TEMPORARY ### $ftp->delete($file);
open(DONE,">".$rvf_incoming.$file.".done");
close(DONE);
$files_moved++;
return 0;
}
$code=$ftp->code();
if($code==0 && $@ eq "")
{
&write_log("! error, unexpected EOF on command channel
+",0);
return 1000;
}
if($code>=400)
{
if($code!=$exempt)
{
&write_log("| [$file] error moving from FTP si
+te - ".$code." $@",0);
$files_error++;
}
return $code;
}
return 0;
}
|