use hash for ftp params

This commit is contained in:
2017-11-01 00:54:47 +01:00
parent 975620449a
commit 9463ca4dcd

View File

@@ -180,16 +180,21 @@ sub trxelab {
$dbh->disconnect;
$ftp_parm //= "";
if ( $ftp_parm ne "" ) {
$ftp_parm = "Debug=>0, " . $ftp_parm;
}
else {
$ftp_parm = "Debug=>0";
$ftp_parm =~ s/\s//g;
my %ftp_parms = (
'Host' => $ftp_addrs,
);
foreach my $parm (split(/,/, $ftp_parm))
{
my ($key, $val) = split(/=>/, $parm);
$ftp_parms{$key} = $val;
}
print getTimeStamp("log") . " - pid $$ >> $tool: ftp parm = $ftp_parm.\n";
print getTimeStamp("log") . " - pid $$ >> $tool: ftp parm = " . Dumper(%ftp_parms) . "\n";
my $ftp = Net::FTP->new( Host=>$ftp_addrs, $ftp_parm )
my $ftp = Net::FTP->new( %ftp_parms )
or die getTimeStamp("log")
. " - pid $$ >> Cannot connect to $ftp_addrs: $@ \n";
$ftp->login( $ftp_user, $ftp_passwd )