Wondering if anyone can help or advise on following issue.
The below script should simply connect to a different server and retrieve certain files for me.
use lib "/xxxxx/xxxxx/xxxxx/xxxx";
use Net::FTP;
my $directory = "xxxxxxxx";
my $destinationDir = "xxxxxxxxx";
my $filePrefix = getYesterdaysDateStamp();
my $fileName = $filePrefix . ".tfl";
my $host = "xx.x.xxxx.xx";
my $user = "xxxxxx";
my $pwd = "xxxxxx";
my $mk_ftp;
chdir($directory)
or die "Cannot change directory", $mk_ftp->message;
$mk_ftp = Net::FTP->new($host, Debug => 0)
or die "Cannot connect to host: $@";
print("Logging in FTP session\n");
$mk_ftp->login($user, $pwd)
or die "Cannot login ", $mk_ftp->message;
print("Change destination directory\n");
$mk_ftp->cwd($destinationDir)
or die "Dir change failed ", $mk_ftp->message;
print("Getting file to put on Fang: $fileName\n");
$mk_ftp->get($fileName)
or die "put failed ", $mk_ftp->message;
print("Closing FTP session\n");
$mk_ftp->quit;
sub getYesterdaysDateStamp {
my $timeSeconds = time();
$timeSeconds = $timeSeconds - (60 * 60 * 24); # seconds in a day
my @time = gmtime($timeSeconds);
my $year = @time[5] + 1900;
my $month = @time[4];
$month++;
my $day = @time[3];
if ($month < 10) { $month = "0$month"; }
if ($day < 10) { $day = "0$day"; }
return "$year-$month-$day";
}
However im getting the following result
Can't locate object method "new" via package "Net::FTP::A" at /usr/perl5/5.00503/sun4-solaris/IO/Socket.pm line 253.
Does anyone know why this error is appearing or even better how to get rid of it??
any advice or info would be much appreciated.