++ed by:
PINGAN KEEDI
1 non-PAUSE user
Author image Marco Dalla Stella

NAME

Net::FTPSSL - A FTP over SSL/TLS class

VERSION 0.04

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";

  $ftps->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.

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.

cdup

Changs directory to the parent of the current directory.

mkdir(DIR)

Creates the indicated directory. No recursion at the moment.

rmdir(DIR)

Removes the empty indicated directory. No recursion at the moment.

noop

It specifies no action other than the server send an OK reply.

AUTHOR

Marco Dalla Stella - <kral at paranoici dot org>

SEE ALSO

Net::Cmd

Net::FTP

Net::SSLeay::Handle

IO::Socket::SSL

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).

BUGS

I'm currently testing the module with proftpd and Titan FTP. I'm having a lot of trouble with the second at the moment. Put or get phases seem to work ok (sysread and syswrite don't return any errors) but the server doesn't receive all the sent data. I'm working on it.

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.