NAME
Net::FTP::Common - Perl extension for simplifying common usages of Net::FTP.
SYNOPSIS
use Net::FTP::Common;
%net_ftp_config = ( Debug => 1, Timeout => 120 );
%common_cfg =
(
User => 'username', # overwrite anonymous user default
Pass => 'password', # overwrite list@rebol.com pass default
Dir => 'pub' # overwrite slash default
);
$ez = Net::FTP::Common->new('ftp.rebol.com', \%net_ftp_config, \%common_cfg);
$host = 'ftp.rebol.com';
# Get a listing of a remote directory:
@listing = $ez->dir($host);
# Make a directory on the remote machine
$ez->mkdir($host, Dir => '/pub/newdir/1/2/3', Recurse => 1);
# Get a file from the remote machine
$ez->get($host, File => 'codex.txt');
# "grep" for a file on the remote machine (slash defaultusing eq)
$ez->grep($host, File => 'needed-file.txt');
# "grep" for a file on the remote machine (slash defaultusing eq)
$ez->check($host, File => 'needed-file.txt');
# note this is no more than you manually calling:
# (scalar grep { $_ = 'needed-file.txt' } $ez->dir($host)) > 0;
# "grep" for a file on the remote machine (using regexp)
$ez->grep($host, File => 'n.*-file.t?t');
# note this is no more than you manually calling:
# (scalar grep { $_ =~ 'n.*-file.t?t' } $ez->dir($host)) > 0;
# can we login to the machine?
$ez->login($host) || die "cant login";
DESCRIPTION
This module is intended to make the common uses of Net::FTP a one-line affair. It was developed to make the development of Net::FTP::Shell straightfoward.
EXPORT
None by default.
AUTHOR
T. M. Brannon <tbone@cpan.org>
SEE ALSO
www.metaperl.com, www.rebol.com, Net::FTP (part of the libnet distribution)