I'm a newbie and this is my attempt at writing a transportable subroutine that will FTP a file to a remote location. I couldn't figure out how to check for errors on the remote host, so anyone that wants to help me out, please do so ...
############################################################
# FTP_FILE - Send a file to FTP host
# Requires: use Net::FTP; # Perl module for FTP access
# Arguments: $sendFile - file to be sent (full path)
# $name - file to be named on remote server
# $host - FTP host name (ftp.japh.org)
# $user - FTP login user name
# $pass - FTP login password
# Returns: none
############################################################
sub ftp_file {
local ($sendFile, $name, $host, $user, $pass) = @_; # Pass file
+name to send
$ftp = Net::FTP->new($host); # Open the host
$ftp->login($user,$pass); # Username and password
$ftp->put($sendFile, $name); # Send the file, rename
$ftp->quit; # Quit
}
####################### END SUBROUTINE #####################