mnlight has asked for the wisdom of the Perl Monks concerning the following question:
sub ftp_file{ my ( $hosts ) = @_; my ($pass, $remotefile); my @hosts = (); my %host = (); my $currdir = cwd(); my $localfile = sprintf("%s/%s", $params->get("Path.From"), $params->get("File")); if ($params->exists("Path.To")){ $remotefile = sprintf("%s/%s", $params->get("Path.To"), $params->get("File")); }#end if statement else{ $remotefile = sprintf("%s/%s", $params->get("Path.From"), $params->get("File")); }#end else statement &ebenx::nm_UnHide($pass, $hosts->[2]); my $host = { 'host' => $hosts->[0], 'login' => $hosts->[1], 'pass' => $pass }; $app->log($INFO, "Copying [ $localfile ] to $$host{host}"); my $ftp = new Net::FTP($$host{host}, Timeout => 30) or $app->log($FATAL, "Unable to initialize ftp object: $!"); $ftp->login($$host{login}, $$host{pass} ) or $app->log($FATAL, "Unable to login to $$host{host}: $!"); $ftp->put($localfile, $remotefile) or $app->log($FATAL, "Unable to put $localfile to $$host{host} + as $remotefile: $!"); $ftp->quit(); }#end ftp_file
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: NET::FTP replaces characters in file with NULL
by Improv (Pilgrim) on Apr 22, 2003 at 17:05 UTC | |
by demerphq (Chancellor) on Apr 22, 2003 at 17:59 UTC | |
by mnlight (Scribe) on Apr 22, 2003 at 18:21 UTC | |
|
Re: NET::FTP replaces characters in file with NULL
by graff (Chancellor) on Apr 23, 2003 at 03:36 UTC |