NAME

XAS::Lib::Curl::FTP - A class to transfer files using FTP

SYNOPSIS

use Badger::URL 'URL';
use XAS::Lib::Curl::FTP;
use Badger::Filesystem 'File';

my $ftp = XAS::Lib::Curl::FTP->new(
    -username = 'kevin',
    -password = 'password',
);

my $url  = URL('ftp://examples.com/directory/file.txt');
my $file = File('file.txt');

if ($ftp->get($url, $file)) {

    printf("fetched %s in %s seconds, at a speed of %s bytes per second\n", 
         $ftp->transfer_time, $ftp->transfer_speed);

}

DESCRIPTION

This module uses WWW::Curl to transfer files using FTP/FTPS.

METHODS

new

This method initializes the module and takes the following parameters:

-keep_alive

A toggle to tell curl to forbid the reuse of sockets, defaults to true.

-connect_timeout

The timeout for the initial connection, defaults to 300 seconds.

-password

An optional password to use, implies a username. Wither the password is actually used, depends on -auth_method.

-username

An optional username to use, implies a password.

-ssl_cacert

An optional CA cerificate to use.

-ssl_keypasswd

An optional password for a signed cerificate.

-ssl_cert

An optional certificate to use.

-ssl_key

An optional key for a certificate to use.

-ssl_verify_host

Wither to verify the host certifcate, defaults to true.

-ssl_verify_peer

Wither to verify the peer certificate, defaults to true.

list($url)

This method will return a list of files for the given url. The format of the list is server dependent.

$url

This is a Badger::URL object of the files url.

info($url)

This method will return the size and DateTime object of the file residing at the url.

$url

This is a Badger::URL object of the files url.

get($url, $file)

This method will get the file at url and place it a files destination. It will return TRUE upon success, or throw an exception on failure.

$url

This is a Badger::URL object of the files url.

$file

This ia a Badger::Filesystem::File object of the files destination.

put($file, $url)

This method will put the file at the destination url. It will return TRUE upon success, or throw an exception on failure.

$url

This is a Badger::URL object of the files url.

$file

This ia a Badger::Filesystem::File object of the files source.

SEE ALSO

XAS::Lib::Curl::HTTP
XAS

AUTHOR

Kevin L. Esteb, <kevin@kesteb.us>

COPYRIGHT AND LICENSE

Copyright (c) 2012-2017 Kevin L. Esteb

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.