网上搜了一下,发现了这个文档,其他基本就不用再看了:

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

为方便查阅,截取部分如下:

  1. use Net::FTP;
  2. $ftp = Net::FTP->new("some.host.name", Debug => 0)
  3. or die "Cannot connect to some.host.name: $@";
  4. $ftp->login("anonymous",'-anonymous@')
  5. or die "Cannot login ", $ftp->message;
  6. $ftp->cwd("/pub")
  7. or die "Cannot change working directory ", $ftp->message;
  8. $ftp->get("that.file")
  9. or die "get failed ", $ftp->message;
  10. $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 package to lookup the login information for the connected host. If no information is found then a login of anonymous is used. If no password is given and the login is anonymous then anonymous@ will be used for password.

If the connection is via a firewall then the authorize method will 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. If both arguments are not specified then authorize uses Net::Netrc 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 will be done if required

binary

Transfer file in binary mode. No transformation will be done.

Hint: If both server and client machines use the same line ending for text files, then it will be faster to transfer all files in binary mode.

rename ( OLDNAME, NEWNAME )

Rename a file on the remote FTP server from OLDNAME to NEWNAME. This is 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 an attempt is made to change the directory to the root directory.

cdup ()

Change directory to the parent of the current directory.

pwd ()

Returns the full pathname of the current directory.

restart ( WHERE )

Set the byte offset at which to begin the next data transfer. Net::FTP simply records this value and uses it when during the next data transfer. For this reason this method will not return an error, but setting it may cause a subsequent data transfer to fail.

rmdir ( DIR [, RECURSE ])

Remove the directory with the name DIR. If RECURSE is true then rmdir will attempt to delete everything inside the directory.

mkdir ( DIR [, RECURSE ])

Create a new directory with the name DIR. If RECURSE is true then mkdir will attempt to create all the directories in the given path.

Returns the full pathname to the new directory.

alloc ( SIZE [, RECORD_SIZE] )

The alloc command allows you to give the ftp server a hint about the size of the file about to be transferred using the ALLO ftp command. Some storage systems use this to make intelligent decisions about how to store the file. The SIZE argument represents the size of the file in bytes. The RECORD_SIZE argument indicates a maximum record or page size for files sent with a record or page structure.

The size of the file will be determined, and sent to the server automatically for normal files so that this method need only be called if you are transferring data from a socket, named pipe, or other stream not associated with a normal file.

ls ( [ DIR ] )

Get a directory listing of DIR, or the current directory.

In an array context, returns a list of lines returned from the server. In a scalar context, returns a reference to a list.

dir ( [ DIR ] )

Get a directory listing of DIR, or the current directory in long format.

In an array context, returns a list of lines returned from the server. In a scalar context, returns a reference to a list.

get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] )

Get REMOTE_FILE from the server and store locally. LOCAL_FILE may be a filename or a filehandle. If not specified, the file will be stored in the current directory with the same leafname as the remote file.

If WHERE is given then the first WHERE bytes of the file will not be transferred, and the remaining bytes will be appended to the local file if it already exists.

Returns LOCAL_FILE, or the generated local file name if LOCAL_FILE is not given. If an error was encountered undef is returned.

put ( LOCAL_FILE [, REMOTE_FILE ] )

Put a file on the remote server. LOCAL_FILE may be a name or a filehandle. If LOCAL_FILE is a filehandle then REMOTE_FILE must be specified. If REMOTE_FILE is not specified then the file will be stored in the current directory with the same leafname as LOCAL_FILE.

Returns REMOTE_FILE, or the generated remote filename if REMOTE_FILE is not given.

NOTE: If for some reason the transfer does not complete and an error is returned then the contents that had been transferred will not be remove automatically.

put_unique ( LOCAL_FILE [, REMOTE_FILE ] )

Same as put but uses the STOU command.

Returns the name of the file on the server.

append ( LOCAL_FILE [, REMOTE_FILE ] )

Same as put but appends to the file on the remote server.

Returns REMOTE_FILE, or the generated remote filename if REMOTE_FILE is not given.

unique_name ()

Returns the name of the last file stored on the server using the STOU command.

mdtm ( FILE )

Returns the modification time of the given file

size ( FILE )

Returns the size in bytes for the given file as stored on the remote server.

NOTE: The size reported is the size of the stored file on the remote server. If the file is subsequently transferred from the server in ASCII mode and the remote server and local machine have different ideas about "End Of Line" then the size of file on the local machine after transfer may be different.

supported ( CMD )

Returns TRUE if the remote server supports the given command.

hash ( [FILEHANDLE_GLOB_REF],[ BYTES_PER_HASH_MARK] )

Called without parameters, or with the first argument false, hash marks are suppressed. If the first argument is true but not a reference to a file handle glob, then \*STDERR is used. The second argument is the number of bytes per hash mark printed, and defaults to 1024. In all cases the return value is a reference to an array of two: the filehandle glob reference and the bytes per hash mark.

feature ( NAME )

Determine if the server supports the specified feature. The return value is a list of lines the server responded with to describe the options that it supports for the given feature. If the feature is unsupported then the empty list is returned.

  if ($ftp->feature( 'MDTM' )) {# Do something}if (grep { /\bTLS\b/ } $ftp->feature('AUTH')) {# Server supports TLS}

The following methods can return different results depending on how they are called. If the user explicitly calls either of the pasv or port methods then these methods will return a true or false value. If the user does not call either of these methods then the result will be a reference to a Net::FTP::dataconn based object.

nlst ( [ DIR ] )

Send an NLST command to the server, with an optional parameter.

list ( [ DIR ] )

Same as nlst but using the LIST command

retr ( FILE )

Begin the retrieval of a file called FILE from the remote server.

stor ( FILE )

Tell the server that you wish to store a file. FILE is the name of the new file that should be created.

stou ( FILE )

Same as stor but using the STOU command. The name of the unique file which was created on the server will be available via the unique_name method after the data connection has been closed.

appe ( FILE )

Tell the server that we want to append some data to the end of a file called FILE. If this file does not exist then create it.

If for some reason you want to have complete control over the data connection, this includes generating it and calling the response method when required, then the user can use these methods to do so.

However calling these methods only affects the use of the methods above that can return a data connection. They have no effect on methods get, put, put_unique and those that do not require data connections.

port ( [ PORT ] )

Send a PORT command to the server. If PORT is specified then it is sent to the server. If not, then a listen socket is created and the correct information sent to the server.

pasv ()

Tell the server to go into passive mode. Returns the text that represents the port on which the server is listening, this text is in a suitable form to sent to another ftp server using the port method.

The following methods can be used to transfer files between two remote servers, providing that these two servers can connect directly to each other.

pasv_xfer ( SRC_FILE, DEST_SERVER [, DEST_FILE ] )

This method will do a file transfer between two remote ftp servers. If DEST_FILE is omitted then the leaf name of SRC_FILE will be used.

pasv_xfer_unique ( SRC_FILE, DEST_SERVER [, DEST_FILE ] )

Like pasv_xfer but the file is stored on the remote server using the STOU command.

pasv_wait ( NON_PASV_SERVER )

This method can be used to wait for a transfer to complete between a passive server and a non-passive server. The method should be called on the passive server with the Net::FTP object for the non-passive server passed as an argument.

abort ()

Abort the current data transfer.

quit ()

Send the QUIT command to the remote FTP server and close the socket connection.

perl中Net::FTP帮助文档相关推荐

  1. Python Tutorial中英双语对照文档5

    Python Tutorial中英双语对照文档4 CHAPTER THIRTEEN WHAT NOW? 现在咧? Reading this tutorial has probably reinforc ...

  2. Word2013中怎样设置同一文档内粘贴选项

    在用户编辑或者书写Word文档时,经常碰到需要将前面已经输入过的某一段文字拷贝粘贴到后面中的情况.用户可以根据实际工作需要预设粘贴格式的类型,可以大大减轻操作上的复杂. 在Word 2013文档中,用 ...

  3. python oop 继承_oop-在Python中继承方法的文档字符串

    oop-在Python中继承方法的文档字符串 我有一个带有文档字符串的OO层次结构,它需要与代码本身一样多的维护. 例如., class Swallow(object): def airspeed(s ...

  4. 如何在ASP.NET Core 中快速构建PDF文档

    比如我们需要ASP.NET Core 中需要通过PDF来进行某些简单的报表开发,随着这并不难,但还是会手忙脚乱的去搜索一些资料,那么恭喜您,这篇帖子会帮助到您,我们就不会再去浪费一些宝贵的时间. 在本 ...

  5. 微信公众号网页开发:播放视频,在列表中滑动会脱离文档流

    项目场景: antd移动端端开发 微信公众号移动端网页开发 问题描述: video-react有问题,在跑马灯中第一次白屏,在列表中滑动会脱离文档流 原因分析: 未知 解决方案: 直接上代码 < ...

  6. 【接口文档】Django restful framework中自动生成API文档

    Django restful framework中自动生成API文档 一.Swagger概述 1.引言 当接口开发完成,紧接着需要编写接口文档.传统的接口文档使用Word编写,or一些接口文档管理平台 ...

  7. 在编码中熟练使用JDK文档

    在编码中熟练使用JDK文档

  8. 在ASP.NET Core中如何将各种文档合并为PDF?Aspose快速搞定!

    在各种业务环境中,将各种文档合并为一个PDF是客户最常问的问题之一.例如,假设您的组织有多个应用程序以XPS和PDF生成特定的文档,使用扫描的图像,并且您的用户希望将其中一些文档合并为一个PDF. 本 ...

  9. wps在word文档中插入xlsx格式文档会自动打开

    wps中插入xlsx格式文档会自动打开文档,导致报错 在word的开发工具中选择COM加载项 将所有的加载项取消 重新打开文件即可

最新文章

  1. 工行分布式数据库选型与大规模容器化实践
  2. Android Studio 新建项目的R文件丢失的解决方法
  3. 程序员转正述职报告_程序员转正述职报告范文
  4. Ubuntu12.04 root用户登录设置
  5. 初步认识java中的方法
  6. 数据库修改服务器ip地址吗,服务器数据库与改ip地址吗
  7. 都觉得自己亏了,那谁赚了——评英国脱欧与俄白统一
  8. win10家庭版添加“本地安全策略”
  9. JavaScript设计模式之装饰者模式
  10. python-skimage.io,filters,transform
  11. 字符串函数的模拟实现
  12. 如何使用C#调用淘宝网页自动搜索,翻页和点击商品
  13. android 固件下载地址,[下载]安卓6.0/Android M第三个开发者预览版固件下载地址
  14. 如何防止服务器记录上网信息,服务器怎么监控上网记录
  15. python笔迹识别_CVPR 2019笔迹识别论文:逆鉴别网络+八路Attention
  16. 2021-12-3 温故而知新-JavaScript隐式转换
  17. linux内核sock_sendmsg,为什么linux中sendto函数中的msg.msg_iovlen=1;
  18. 男士最佳衣着选择搭配
  19. 【读书】凯文凯利,通向未来的12个趋势
  20. Zemax---Sequential and Non-Sequential模式(插图待补充)

热门文章

  1. Eclipse中如何恢复已删除文件
  2. mysql-零基础安装
  3. JQuery------各种版本下载
  4. Ubuntu 下常用的命令 简略记录
  5. 二.Sql语言的分类及运算符
  6. 《Javascript语言精粹》 读书笔记
  7. android 开发时遇到的环境问题3--eclipse整个项目工程报错
  8. 区分Activity的四种加载模式
  9. DataNode内部的各种数据结构
  10. windows批量添加用户