I am using the standard Net::FTP code in a subroutine as in below:
What I am looking for is a way to determine after the FTP is performed if it was succsesful, and if not print the reason. This is to replace the line:
which print regardless if the FTP works or not.
Thanks,
Nick
If at first you don't succeed, don't try skydiving.
Code:
sub GetFTP
{
##########################################################################################
#
# This subroutine performs an FTP Get using the Net::FTP module
#
##########################################################################################
my $ftp_server = shift(@_);
my $sub_pass = shift(@_);
my $sub_uid = shift(@_);
my $sub_path = shift(@_);
my $sub_log = shift(@_);
print "Beginning FTP Get from $ftp_server. Getting log $sub_log from path $sub_path\n";
print "FTP Debug output:\n\n";
my $ftp = Net::FTP->new("$ftp_server", Debug => 1, Timeout => 1300)
or ErrorOut("Cannot connect to $ftp_server: $@");
$ftp->login($sub_uid,$sub_pass)
or ErrorOut("Cannot login ", $ftp->message);
$ftp->cwd($sub_path)
or ErrorOut("Cannot change working directory ", $ftp->message);
$ftp->get($sub_log)
or ErrorOut("get failed ", $ftp->message);
$ftp->quit;
print "\nEnd FTP debug output\n\n";
print "FTP Get successful from server $ftp_server\n";
} # End sub NetFTP
What I am looking for is a way to determine after the FTP is performed if it was succsesful, and if not print the reason. This is to replace the line:
Code:
print "FTP Get successful from server $ftp_server\n";
which print regardless if the FTP works or not.
Thanks,
Nick
If at first you don't succeed, don't try skydiving.