The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Smoke::FTPClient - Implement a mirror like object

SYNOPSIS

    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;

DESCRIPTION

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.

This solution is slow, you'd better use rsync!

METHODS

Test::Smoke::FTPClient->new( $server[, %options] )

Create a new object with option checking:

    * fuser
    * fpasswd
    * v
    * fpassive
    * ftype

$ftpclient->connect( )

Returns true for success after connecting and login.

$client->mirror( $sdir, $ddir )

Set-up the environment and call __do_mirror()

$client->bye

Disconnect from the FTP-server and cleanup the Net::FTP client;

Test::Smoke::FTPClient->config( $key[, $value] )

config() is an interface to the package lexical %CONFIG, which holds all the default values for the new() arguments.

With the special key all_defaults this returns a reference to a hash holding all the default values.

__do_mirror( $ftp, $ftpdir, $localdir, $lroot, $verbose, $cleanup )

Recursive sub to mirror a tree from an FTP server.

dirlist( $ftp, $verbose )

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

__parse_line_from_dir( $line, $verbose )

The dir command in FTP gives a sort of ls -la output, parts of this output are used as remote file-info.

__get_mode_from_text( $tmode )

This takes the text representation of a file-mode (like 'rwxr--r--') and return the numeric value.

__time_from_ls( $mname, $day, $time_or_year )

This takes the three date/time related columns from the ls -la output and returns a localtime-stamp.

__time_from_windows( $date, $time )

This takes the two date/time related columns from the dir output and returns a localtime-stamp

SEE ALSO

Test::Smoke::Syncer

COPYRIGHT & LICENSE

(c) 2003, 2004, 2005, 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.