
May 31st, 2001, 02:31 PM
|
|
Contributing User
|
|
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44
Time spent in forums: < 1 sec
Reputation Power: 12
|
|
Ftp example with color comments
#!/usr/bin/perl
use Net::FTP;
# Net::FTP part of libnet
# http://www.cpan.org/authors/id/GBAR...t-1.0703.tar.gz
# set up some variables
$host = "127.0.0.1"; # local host for this test script
$username = "jen"; # Temp user Jenny
$password = "jen"; # Her password
$Folder = "/home/jen"; # Her home directory where she can write to
# Connect
$ftp = Net::FTP->new("$host") || die "Could not connect to $host : $!";
# Login
$ftp->login("$username","$password") || die "Could not login : $!";
# Do some work -- assumes user can write to folder and use chmod
$ftp->cwd("$Folder") || die "Could not cd to $Folder : $!";
# assumes new.cgi right beside ftp.pl in same directory
$ftp->put("new.cgi") || die "Could not put new.cgi : $!";
$ftp->site("CHMOD 755 new.cgi") || die "Could not chmod new.cgi : $!";
# Close Connection
$ftp->quit;
exit;
# Tested on Red Hat Linux 7.0, perl 5.6, libnet-1.0703 and temp created user jen
# Testing out color coding
__________________
Thanks
Foot in Mouth ver 1.2.5 Onion
|