eval "&billco_upload( 'agentnum' => $agentnum, 'date' => $date );";
warn "billco_upload failed: $@\n"
- if ( $@ );
+ if $@;
}
my $agentnum = $opt{agentnum} or die "no agentnum provided\n";
my $url = $conf->config( 'billco-url', $agentnum )
or die "no url for agent $agentnum\n";
+ $url =~ s/^\s+//; $url =~ s/\s+$//;
my $username = $conf->config( 'billco-username', $agentnum, 1 )
or die "no username for agent $agentnum\n";
my $password = $conf->config( 'billco-password', $agentnum, 1 )
or die "no password for agent $agentnum\n";
- my $clicode = $conf->config( 'billco-clicode', $agentnum )
- or die "no clicode for agent $agentnum\n";
+ my $clicode = $conf->config( 'billco-clicode', $agentnum, 1 );
+ #or die "no clicode for agent $agentnum\n";
die "no date provided\n" unless $opt{date};
my $zipfile = "$dir/agentnum$agentnum-$opt{date}.zip";
my($hostname, $path) = ($1, $2);
- my $ftp = new Net::FTP($hostname)
+ my $ftp = new Net::FTP($hostname) #, Passive=>1 )
or die "can't connect to $hostname: $@\n";
$ftp->login($username, $password)
or die "can't login to $hostname: ". $ftp->message."\n";
- $ftp->cwd($path)
- or die "can't cd $path on $hostname: ". $ftp->message. "\n";
+ unless ( $ftp->cwd($path) ) {
+ my $msg = "can't cd $path on $hostname: ". $ftp->message. "\n";
+ ( $path eq '/' ) ? warn $msg : die $msg;
+ }
$ftp->binary
or die "can't set binary mode on $hostname\n";