23 Oct 2005 14:56:37 UTC
- Distribution: Net-FTPSSL
- Module version: 0.04
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (10 / 12 / 1)
- KwaliteeBus factor: 0
- License: unknown
- Activity24 month
- Download (7.6KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
Net::FTPSSL - A FTP over SSL/TLS class
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();
Net::FTPSSLis a class implementing a simple FTP client over a Secure Shell Layer (SSL) connection written in Perl as described in RFC959 and RFC2228.
- new ( HOST [, OPTIONS ])
Creates a new Net::FTPSSL object and opens a connection with the
HOSTis 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.
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.
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.
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.
listbut returns the list in this format:
foo pub bar
Personally, I suggest to use list instead of nlst.
Sets the transfer file in ASCII mode.
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.
Deletes the indicated REMOTE_FILE.
Attempts to change directory to the directory given in DIR.
Returns the full pathname of the current directory.
Changs directory to the parent of the current directory.
Creates the indicated directory. No recursion at the moment.
Removes the empty indicated directory. No recursion at the moment.
It specifies no action other than the server send an OK reply.
Marco Dalla Stella - <kral at paranoici dot org>
Graham Barr <gbarr at pobox dot com> - for have written such a great collection of modules (libnet).
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 (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.