I have problem with my perl script.
This perl script i added on my crontab that will run every hour.
But sometimes when i checked the log, the ftp is not running and got message :
Can't call method "login" on an undefined value at
But the thing is, this is intermeatten. Let's say at time 01.00, 02.00 it works then at 03.00, it is not working
then 04.00 it's working again, 05.0 it's not working again.
I was wondering what is the cause of it ?
I understand that this is because the perl is unable to call Net::Ftp module.
But what i don't understand is what is the cause of the ftp can not call the module or login ?
I try to add some ping command, but unfortunately i don't have any root password, so i can not use ping command.
&log ("Trying to get new FTP connection");
$ftp=Net::FTP->new($host,Debug => 1) or $newerr=1;
push (@ERRORS, "Can't ftp to $host: $!\n") if $newerr;
&log ("Error: $newerr ", @ERRORS) if $newerr;
&log("Login FTP server, host = $host, user = $user, password not shown");
$ftp->login($user,$passwd) or $newerr=1;