NAME
Net::FTPSSL - A FTP over SSL/TLS class
VERSION 0.02
SYNOPSIS
use Net::FTPSSL;
my $ftps = Net::FTPSSL->new('ftp.yoursecureserver.com',
port => 21,
encryption => 'E',
debug => 1)
or die "Can't open ftp.yoursecureserver.com";
$ftp->login('anonymous', 'user@localhost')
or die "Can't login: ", $ftps->$last_message();
$ftps->cwd("/pub") or die "Can't change directory: ", $ftps->last_message;
$ftps->get("file") or die "Can't get file: ", $ftps->last_message;
$ftps->quit();
DESCRIPTION
Net::FTPSSL
is a class implementing a simple FTP client over a Secure Shell Layer (SSL) connection written in Perl as described in RFC959 and RFC2228.
CONSTRUCTOR
- new ( HOST [, OPTIONS ])
-
Creates a new Net::FTPSSL object and opens a connection with the
HOST
.HOST
is the address of the FTP server and it's a required argument. OPTIONS are passed in a hash like fashion, using key and value pairs.OPTIONS
are:port - The port number to connect to on the remote FTP server. Default value is 21.
encryption - The connection can be implicitly (IMP_CRYPT) or explicitly (EXP_CRYPT) encrypted. In explicit cases the connection begins clear and became encrypted after an "AUTH" command is sent. Default value is EXP_CRYPT.
method - The connection method passed by the "AUTH" command. This option is ignored when the connection is implicitly encrypted (IMP_CRYPT). May be "SSL" or "TLS".
timeout - Set a connection timeout value. Default value is 120.
buffer - This is the block size that Net::FTPSSL will use when a transfer is made. Default value is 10240.
debug - This set the debug informations option on/off. Default is off.
METHODS
All the methods return true or false, true when the operation was a succes and false when failed. Methods like list or nlst return an empty array when fail.
- login(USER, PASSWORD)
-
Use the given informations to log into the FTP server.
- list([DIRECTORY])
-
This method returns a list of files in this format:
total 5 drwxrwx--- 1 owner group 512 May 31 11:16 . drwxrwx--- 1 owner group 512 May 31 11:16 .. drwxrwx--- 1 owner group 512 Oct 27 2004 foo drwxrwx--- 1 owner group 512 Oct 27 2004 pub drwxrwx--- 1 owner group 512 Mar 29 12:09 bar
If DIRECTORY is omitted, the method will return the list of the current directory.
- nlst([DIRECTORY])
-
Same as
list
but returns the list in this format:foo pub bar
Personally, I suggest to use list instead of nlst.
- ascii
-
Sets the transfer file in ASCII mode.
- binary
-
Sets the transfer file in binary mode. No transformation will be done.
- get(REMOTE_FILE, LOCAL_FILE)
-
Retrives the REMOTE_FILE from the ftp server. LOCAL_FILE may be a filename or a filehandle. Return undef if it fails.
- put(LOCAL_FILE, [REMOTE_FILE])
-
Stores the LOCAL_FILE into the remote ftp server. LOCAL_FILE may be filehandle, but in this case REMOTE_FILE is required. Return undef if it fails.
- delete(REMOTE_FILE)
-
Deletes the indicated REMOTE_FILE.
- cwd(DIR)
-
Attempts to change directory to the directory given in DIR.
- pwd
-
Returns the full pathname of the current directory.
- noop
-
It specifies no action other than the server send an OK reply.
AUTHOR
Marco Dalla Stella - <kral at paranoici dot org>
SEE ALSO
RFC 2228 - ftp://ftp.rfc-editor.org/in-notes/rfc2228.txt
CREDITS
Graham Barr <gbarr at pobox dot com> - for have written such a great collection of modules (libnet).
COPYRIGHT
Copyright (c) 2005 Marco Dalla Stella. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.