Net::ftp Help document in Perl

Source: Internet
Author: User
Tags anonymous ftp remote ftp server response code firewall

Search on the Internet, found this document, the other basic do not have to look at:

http://search.cpan.org/~gbarr/libnet-1.22/Net/FTP.pm

For easy access, the interception section is as follows:

Use net::ftp;     
        
$ftp = Net::ftp->new ("Some.host.name", Debug => 0)     
  or die "Cannot connect to Some.host.name: $@";     
        
$ftp->login ("Anonymous", '-anonymous@ ')     
  or die "Cannot login", $ftp->message;     
        
$ftp->cwd ("/pub")     
  or die "Cannot change working directory", $ftp->message;     
        
$ftp->get ("That.file")     
  or Die "Get Failed", $ftp->message;     
        
$ftp->quit;

Login ([login [, PASSWORD [, account]]]

Log into the remote FTP server with the given login information. If no arguments are given then the NET::FTP uses the NET::NETRC to lookup the login package for the information Host. If no information is found then a login to anonymous is used. If no password is given and the login is anonymous then anonymous@ 'll be used for password.

If the connection is via a firewall then, the authorize method would be called with no arguments.

Authorize ([AUTH [, RESP]])

This is a protocol used by some firewall FTP proxies. It is used to authorise the user to send data out. The If both arguments are not specified then authorize the uses to do a lookup.

Site (ARGS)

Send a SITE command to the remote server and wait for a response.

Returns most significant digit of the response code.

Ascii

Transfer file in ASCII. CRLF translation would be done if required

Binary

Transfer file in binary mode. No transformation is done.

Hint:if both server and client machines use the same line ending for text files, then it'll be faster to transfer all F Iles in binary mode.

Rename (oldname, NEWNAME)

Rename a file on the remote FTP server from Oldname to NEWNAME. This are done by sending the RNFR and Rnto commands.

Delete (FILENAME)

Send a request to the server to delete FILENAME.

CWD ([DIR])

Attempt to change directory to the directory given in $dir. If $dir is "...", the FTP cdup command is used to attempt to move up one directory. If No directory is given then a attempt is made to the directory.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.