Test::Smoke::FTPClient - Implement a mirror like object
use Test::Smoke::FTPClient; my $server = 'ftp.linux.activestate.com'; my $fc = Test::Smoke::FTPClient->new( $server ); my $sdir = '/pub/staff/gsar/APC/perl-current'; my $ddir = '~/perlsmoke/perl-current'; my $cleanup = 1; # like --delete for rsync $fc->connect; $fc->mirror( $sdir, $ddir, $cleanup ); $fc->bye;
This module was written specifically to fetch a perl source-tree from the APC. It will not suffice as a general purpose mirror module! It only distinguishes between files and directories and relies on the output of the Net::FTP->dir method.
Net::FTP->dir
This solution is slow, you'd better use rsync!
Create a new object with option checking:
* fuser * fpasswd * v * fpassive
Returns true for success after connecting and login.
Set-up the environment and call __do_mirror()
__do_mirror()
Disconnect from the FTP-server and cleanup the Net::FTP client;
config() is an interface to the package lexical %CONFIG, which holds all the default values for the new() arguments.
config()
%CONFIG
new()
With the special key all_defaults this returns a reference to a hash holding all the default values.
Recursive sub to mirror a tree from an FTP server.
Return a list of entries (hashrefs) with these properties:
* name: Filename * type f/d/l * mode unix file mode * size filessize in bytes * date file date
The dir command in FTP gives a sort of ls -la output, parts of this output are used as remote file-info.
dir
ls -la
This takes the text representation of a file-mode (like 'rwxr--r--') and return the numeric value.
This takes the three date/time related columns from the ls -la output and returns a localtime-stamp.
Test::Smoke::Syncer
(c) 2003-2004, Abe Timmerman <abeltje@cpan.org> All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See:
* <http://www.perl.com/perl/misc/Artistic.html>, * <http://www.gnu.org/copyleft/gpl.html>
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install Test::Smoke, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Smoke
CPAN shell
perl -MCPAN -e shell install Test::Smoke
For more information on module installation, please visit the detailed CPAN module installation guide.