Dear potential employer.
Follows the code fragment, modified at your request.
I hope it will work fine for you. In case of complete satisfaction, please, accept my bid, for me to be able to leave 5-star feedback for you.
Please, let me know if you would like to make any further modifications (for example I would strongly advice you to use strict pragma).
Looking forward for update from you.
Thank you
my @delay_periods = qw/ 0 10 30 60 /;
my $ftp;
foreach my $delay (@delay_periods){
sleep($delay);
print "Waiting $delay seconds to Retry\n" if $delay;
eval{
$ftp = Net::FTP->new($spr_host_name, Timeout => 30, Passive => 1, Debug => 1,);
};
last unless $@;
die print "\n Can not connect to SPR: $@<br>--FTP Down-- \n" if $delay == $delay_periods[$#delay_periods];
}
$ftp->login($ftp_login_name,$ftp_login_pass) or die print "Couldn't Login $@\n";
foreach my $delay (@delay_periods){
sleep($delay);
print "Waiting $delay seconds to Retry\n" if $delay;
eval{
$ftp->put($local_file,$remote_file);
};
unless($@){
print "putting $local_file -to- $remote_file\n";
last;
}
else{
die print "Couldn't Send EDI Request to SPR! $@\n" if $delay == $delay_periods[$#delay_periods];
}
}
$ftp->rename($remote_file,$remote_file2) or die print "Couldn't Rename $@\n";