.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\" ========================================================================
.\"
.IX Title "Net::FTP 3"
.TH Net::FTP 3 "2017-11-14" "perl v5.10.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Net::FTP \- FTP Client class
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& use Net::FTP;
\&
\& $ftp = Net::FTP\->new("some.host.name", Debug => 0)
\& or die "Cannot connect to some.host.name: $@";
\&
\& $ftp\->login("anonymous",\*(Aq\-anonymous@\*(Aq)
\& 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;
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
\&\f(CW\*(C`Net::FTP\*(C'\fR is a class implementing a simple \s-1FTP\s0 client in Perl as
described in \s-1RFC959\s0. It provides wrappers for the commonly used subset of the
\&\s-1RFC959\s0 commands.
If IO::Socket::IP or IO::Socket::INET6 is installed it also provides
support for IPv6 as defined in \s-1RFC2428\s0.
And with IO::Socket::SSL installed it provides support for implicit \s-1FTPS\s0
and explicit \s-1FTPS\s0 as defined in \s-1RFC4217\s0.
.PP
The Net::FTP class is a subclass of Net::Cmd and (depending on avaibility) of
IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET.
.SH "OVERVIEW"
.IX Header "OVERVIEW"
\&\s-1FTP\s0 stands for File Transfer Protocol. It is a way of transferring
files between networked machines. The protocol defines a client
(whose commands are provided by this module) and a server (not
implemented in this module). Communication is always initiated by the
client, and the server responds with a message and a status code (and
sometimes with data).
.PP
The \s-1FTP\s0 protocol allows files to be sent to or fetched from the
server. Each transfer involves a \fBlocal file\fR (on the client) and a
\&\fBremote file\fR (on the server). In this module, the same file name
will be used for both local and remote if only one is specified. This
means that transferring remote file \f(CW\*(C`/path/to/file\*(C'\fR will try to put
that file in \f(CW\*(C`/path/to/file\*(C'\fR locally, unless you specify a local file
name.
.PP
The protocol also defines several standard \fBtranslations\fR which the
file can undergo during transfer. These are \s-1ASCII\s0, \s-1EBCDIC\s0, binary,
and byte. \s-1ASCII\s0 is the default type, and indicates that the sender of
files will translate the ends of lines to a standard representation
which the receiver will then translate back into their local
representation. \s-1EBCDIC\s0 indicates the file being transferred is in
\&\s-1EBCDIC\s0 format. Binary (also known as image) format sends the data as
a contiguous bit stream. Byte format transfers the data as bytes, the
values of which remain the same regardless of differences in byte size
between the two machines (in theory \- in practice you should only use
this if you really know what you're doing). This class does not support
the \s-1EBCDIC\s0 or byte formats, and will default to binary instead if they
are attempted.
.SH "CONSTRUCTOR"
.IX Header "CONSTRUCTOR"
.IP "new ([ \s-1HOST\s0 ] [, \s-1OPTIONS\s0 ])" 4
.IX Item "new ([ HOST ] [, OPTIONS ])"
This is the constructor for a new Net::FTP object. \f(CW\*(C`HOST\*(C'\fR is the
name of the remote host to which an \s-1FTP\s0 connection is required.
.Sp
\&\f(CW\*(C`HOST\*(C'\fR is optional. If \f(CW\*(C`HOST\*(C'\fR is not given then it may instead be
passed as the \f(CW\*(C`Host\*(C'\fR option described below.
.Sp
\&\f(CW\*(C`OPTIONS\*(C'\fR are passed in a hash like fashion, using key and value pairs.
Possible options are:
.Sp
\&\fBHost\fR \- \s-1FTP\s0 host to connect to. It may be a single scalar, as defined for
the \f(CW\*(C`PeerAddr\*(C'\fR option in IO::Socket::INET, or a reference to
an array with hosts to try in turn. The \*(L"host\*(R" method will return the value
which was used to connect to the host.
.Sp
\&\fBFirewall\fR \- The name of a machine which acts as an \s-1FTP\s0 firewall. This can be
overridden by an environment variable \f(CW\*(C`FTP_FIREWALL\*(C'\fR. If specified, and the
given host cannot be directly connected to, then the
connection is made to the firewall machine and the string \f(CW@hostname\fR is
appended to the login identifier. This kind of setup is also referred to
as an ftp proxy.
.Sp
\&\fBFirewallType\fR \- The type of firewall running on the machine indicated by
\&\fBFirewall\fR. This can be overridden by an environment variable
\&\f(CW\*(C`FTP_FIREWALL_TYPE\*(C'\fR. For a list of permissible types, see the description of
ftp_firewall_type in Net::Config.
.Sp
\&\fBBlockSize\fR \- This is the block size that Net::FTP will use when doing
transfers. (defaults to 10240)
.Sp
\&\fBPort\fR \- The port number to connect to on the remote machine for the
\&\s-1FTP\s0 connection
.Sp
\&\fB\s-1SSL\s0\fR \- If the connection should be done from start with \s-1SSL\s0, contrary to later
upgrade with \f(CW\*(C`starttls\*(C'\fR.
.Sp
\&\fBSSL_*\fR \- \s-1SSL\s0 arguments which will be applied when upgrading the control or
data connection to \s-1SSL\s0. You can use \s-1SSL\s0 arguments as documented in
IO::Socket::SSL, but it will usually use the right arguments already.
.Sp
\&\fBTimeout\fR \- Set a timeout value in seconds (defaults to 120)
.Sp
\&\fBDebug\fR \- debug level (see the debug method in Net::Cmd)
.Sp
\&\fBPassive\fR \- If set to a non-zero value then all data transfers will
be done using passive mode. If set to zero then data transfers will be
done using active mode. If the machine is connected to the Internet
directly, both passive and active mode should work equally well.
Behind most firewall and \s-1NAT\s0 configurations passive mode has a better
chance of working. However, in some rare firewall configurations,
active mode actually works when passive mode doesn't. Some really old
\&\s-1FTP\s0 servers might not implement passive transfers. If not specified,
then the transfer mode is set by the environment variable
\&\f(CW\*(C`FTP_PASSIVE\*(C'\fR or if that one is not set by the settings done by the
\&\fIlibnetcfg\fR utility. If none of these apply then passive mode is
used.
.Sp
\&\fBHash\fR \- If given a reference to a file handle (e.g., \f(CW\*(C`\e*STDERR\*(C'\fR),
print hash marks (#) on that filehandle every 1024 bytes. This
simply invokes the \f(CW\*(C`hash()\*(C'\fR method for you, so that hash marks
are displayed for all transfers. You can, of course, call \f(CW\*(C`hash()\*(C'\fR
explicitly whenever you'd like.
.Sp
\&\fBLocalAddr\fR \- Local address to use for all socket connections. This
argument will be passed to the super class, i.e. IO::Socket::INET
or IO::Socket::IP.
.Sp
\&\fBDomain\fR \- Domain to use, i.e. \s-1AF_INET\s0 or \s-1AF_INET6\s0. This
argument will be passed to the IO::Socket super class.
This can be used to enforce IPv4 even with IO::Socket::IP
which would default to IPv6.
\&\fBFamily\fR is accepted as alternative name for \fBDomain\fR.
.Sp
If the constructor fails undef will be returned and an error message will
be in $@
.SH "METHODS"
.IX Header "METHODS"
Unless otherwise stated all methods return either a \fItrue\fR or \fIfalse\fR
value, with \fItrue\fR meaning that the operation was a success. When a method
states that it returns a value, failure will be returned as \fIundef\fR or an
empty list.
.PP
\&\f(CW\*(C`Net::FTP\*(C'\fR inherits from \f(CW\*(C`Net::Cmd\*(C'\fR so methods defined in \f(CW\*(C`Net::Cmd\*(C'\fR may
be used to send commands to the remote \s-1FTP\s0 server in addition to the methods
documented here.
.IP "login ([\s-1LOGIN\s0 [,PASSWORD [, \s-1ACCOUNT\s0] ] ])" 4
.IX Item "login ([LOGIN [,PASSWORD [, ACCOUNT] ] ])"
Log into the remote \s-1FTP\s0 server with the given login information. If
no arguments are given then the \f(CW\*(C`Net::FTP\*(C'\fR uses the \f(CW\*(C`Net::Netrc\*(C'\fR
package to lookup the login information for the connected host.
If no information is found then a login of \fIanonymous\fR is used.
If no password is given and the login is \fIanonymous\fR then \fIanonymous@\fR
will be used for password.
.Sp
If the connection is via a firewall then the \f(CW\*(C`authorize\*(C'\fR method will
be called with no arguments.
.IP "starttls ()" 4
.IX Item "starttls ()"
Upgrade existing plain connection to \s-1SSL\s0.
The \s-1SSL\s0 arguments have to be given in \f(CW\*(C`new\*(C'\fR already because they are needed for
data connections too.
.IP "stoptls ()" 4
.IX Item "stoptls ()"
Downgrade existing \s-1SSL\s0 connection back to plain.
This is needed to work with some \s-1FTP\s0 helpers at firewalls, which need to see the
\&\s-1PORT\s0 and \s-1PASV\s0 commands and responses to dynamically open the necessary ports.
In this case \f(CW\*(C`starttls\*(C'\fR is usually only done to protect the authorization.
.IP "prot ( \s-1LEVEL\s0 )" 4
.IX Item "prot ( LEVEL )"
Set what type of data channel protection the client and server will be using.
Only \f(CW\*(C`LEVEL\*(C'\fRs \*(L"C\*(R" (clear) and \*(L"P\*(R" (private) are supported.
.IP "host ()" 4
.IX Item "host ()"
Returns the value used by the constructor, and passed to the IO::Socket super
class to connect to the host.
.IP "account( \s-1ACCT\s0 )" 4
.IX Item "account( ACCT )"
Set a string identifying the user's account.
.IP "authorize ( [\s-1AUTH\s0 [, \s-1RESP\s0]])" 4
.IX Item "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 \f(CW\*(C`authorize\*(C'\fR uses \f(CW\*(C`Net::Netrc\*(C'\fR to do a lookup.
.IP "site (\s-1ARGS\s0)" 4
.IX Item "site (ARGS)"
Send a \s-1SITE\s0 command to the remote server and wait for a response.
.Sp
Returns most significant digit of the response code.
.IP "ascii ()" 4
.IX Item "ascii ()"
Transfer file in \s-1ASCII\s0. \s-1CRLF\s0 translation will be done if required
.IP "binary ()" 4
.IX Item "binary ()"
Transfer file in binary mode. No transformation will be done.
.Sp
\&\fBHint\fR: 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.
.IP "type ( [ \s-1TYPE\s0 ] )" 4
.IX Item "type ( [ TYPE ] )"
Set or get if files will be transferred in \s-1ASCII\s0 or binary mode.
.IP "rename ( \s-1OLDNAME\s0, \s-1NEWNAME\s0 )" 4
.IX Item "rename ( OLDNAME, NEWNAME )"
Rename a file on the remote \s-1FTP\s0 server from \f(CW\*(C`OLDNAME\*(C'\fR to \f(CW\*(C`NEWNAME\*(C'\fR. This
is done by sending the \s-1RNFR\s0 and \s-1RNTO\s0 commands.
.IP "delete ( \s-1FILENAME\s0 )" 4
.IX Item "delete ( FILENAME )"
Send a request to the server to delete \f(CW\*(C`FILENAME\*(C'\fR.
.IP "cwd ( [ \s-1DIR\s0 ] )" 4
.IX Item "cwd ( [ DIR ] )"
Attempt to change directory to the directory given in \f(CW$dir\fR. If
\&\f(CW$dir\fR is \f(CW".."\fR, the \s-1FTP\s0 \f(CW\*(C`CDUP\*(C'\fR 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.
.IP "cdup ()" 4
.IX Item "cdup ()"
Change directory to the parent of the current directory.
.IP "passive ( [ \s-1PASSIVE\s0 ] )" 4
.IX Item "passive ( [ PASSIVE ] )"
Set or get if data connections will be initiated in passive mode.
.IP "pwd ()" 4
.IX Item "pwd ()"
Returns the full pathname of the current directory.
.IP "restart ( \s-1WHERE\s0 )" 4
.IX Item "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.
.IP "rmdir ( \s-1DIR\s0 [, \s-1RECURSE\s0 ])" 4
.IX Item "rmdir ( DIR [, RECURSE ])"
Remove the directory with the name \f(CW\*(C`DIR\*(C'\fR. If \f(CW\*(C`RECURSE\*(C'\fR is \fItrue\fR then
\&\f(CW\*(C`rmdir\*(C'\fR will attempt to delete everything inside the directory.
.IP "mkdir ( \s-1DIR\s0 [, \s-1RECURSE\s0 ])" 4
.IX Item "mkdir ( DIR [, RECURSE ])"
Create a new directory with the name \f(CW\*(C`DIR\*(C'\fR. If \f(CW\*(C`RECURSE\*(C'\fR is \fItrue\fR then
\&\f(CW\*(C`mkdir\*(C'\fR will attempt to create all the directories in the given path.
.Sp
Returns the full pathname to the new directory.
.IP "alloc ( \s-1SIZE\s0 [, \s-1RECORD_SIZE\s0] )" 4
.IX Item "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 \s-1ALLO\s0 ftp command. Some storage
systems use this to make intelligent decisions about how to store the file.
The \f(CW\*(C`SIZE\*(C'\fR argument represents the size of the file in bytes. The
\&\f(CW\*(C`RECORD_SIZE\*(C'\fR argument indicates a maximum record or page size for files
sent with a record or page structure.
.Sp
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.
.IP "ls ( [ \s-1DIR\s0 ] )" 4
.IX Item "ls ( [ DIR ] )"
Get a directory listing of \f(CW\*(C`DIR\*(C'\fR, or the current directory.
.Sp
In an array context, returns a list of lines returned from the server. In
a scalar context, returns a reference to a list.
.IP "dir ( [ \s-1DIR\s0 ] )" 4
.IX Item "dir ( [ DIR ] )"
Get a directory listing of \f(CW\*(C`DIR\*(C'\fR, or the current directory in long format.
.Sp
In an array context, returns a list of lines returned from the server. In
a scalar context, returns a reference to a list.
.IP "get ( \s-1REMOTE_FILE\s0 [, \s-1LOCAL_FILE\s0 [, \s-1WHERE\s0]] )" 4
.IX Item "get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] )"
Get \f(CW\*(C`REMOTE_FILE\*(C'\fR from the server and store locally. \f(CW\*(C`LOCAL_FILE\*(C'\fR 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.
.Sp
If \f(CW\*(C`WHERE\*(C'\fR is given then the first \f(CW\*(C`WHERE\*(C'\fR bytes of the file will
not be transferred, and the remaining bytes will be appended to
the local file if it already exists.
.Sp
Returns \f(CW\*(C`LOCAL_FILE\*(C'\fR, or the generated local file name if \f(CW\*(C`LOCAL_FILE\*(C'\fR
is not given. If an error was encountered undef is returned.
.IP "put ( \s-1LOCAL_FILE\s0 [, \s-1REMOTE_FILE\s0 ] )" 4
.IX Item "put ( LOCAL_FILE [, REMOTE_FILE ] )"
Put a file on the remote server. \f(CW\*(C`LOCAL_FILE\*(C'\fR may be a name or a filehandle.
If \f(CW\*(C`LOCAL_FILE\*(C'\fR is a filehandle then \f(CW\*(C`REMOTE_FILE\*(C'\fR must be specified. If
\&\f(CW\*(C`REMOTE_FILE\*(C'\fR is not specified then the file will be stored in the current
directory with the same leafname as \f(CW\*(C`LOCAL_FILE\*(C'\fR.
.Sp
Returns \f(CW\*(C`REMOTE_FILE\*(C'\fR, or the generated remote filename if \f(CW\*(C`REMOTE_FILE\*(C'\fR
is not given.
.Sp
\&\fB\s-1NOTE\s0\fR: 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.
.IP "put_unique ( \s-1LOCAL_FILE\s0 [, \s-1REMOTE_FILE\s0 ] )" 4
.IX Item "put_unique ( LOCAL_FILE [, REMOTE_FILE ] )"
Same as put but uses the \f(CW\*(C`STOU\*(C'\fR command.
.Sp
Returns the name of the file on the server.
.IP "append ( \s-1LOCAL_FILE\s0 [, \s-1REMOTE_FILE\s0 ] )" 4
.IX Item "append ( LOCAL_FILE [, REMOTE_FILE ] )"
Same as put but appends to the file on the remote server.
.Sp
Returns \f(CW\*(C`REMOTE_FILE\*(C'\fR, or the generated remote filename if \f(CW\*(C`REMOTE_FILE\*(C'\fR
is not given.
.IP "unique_name ()" 4
.IX Item "unique_name ()"
Returns the name of the last file stored on the server using the
\&\f(CW\*(C`STOU\*(C'\fR command.
.IP "mdtm ( \s-1FILE\s0 )" 4
.IX Item "mdtm ( FILE )"
Returns the \fImodification time\fR of the given file
.IP "size ( \s-1FILE\s0 )" 4
.IX Item "size ( FILE )"
Returns the size in bytes for the given file as stored on the remote server.
.Sp
\&\fB\s-1NOTE\s0\fR: The size reported is the size of the stored file on the remote server.
If the file is subsequently transferred from the server in \s-1ASCII\s0 mode
and the remote server and local machine have different ideas about
\&\*(L"End Of Line\*(R" then the size of file on the local machine after transfer
may be different.
.IP "supported ( \s-1CMD\s0 )" 4
.IX Item "supported ( CMD )"
Returns \s-1TRUE\s0 if the remote server supports the given command.
.IP "hash ( [\s-1FILEHANDLE_GLOB_REF\s0],[ \s-1BYTES_PER_HASH_MARK\s0] )" 4
.IX Item "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 \e*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.
.IP "feature ( \s-1NAME\s0 )" 4
.IX Item "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.
.Sp
.Vb 3
\& if ($ftp\->feature( \*(AqMDTM\*(Aq )) {
\& # Do something
\& }
\&
\& if (grep { /\ebTLS\eb/ } $ftp\->feature(\*(AqAUTH\*(Aq)) {
\& # Server supports TLS
\& }
.Ve
.PP
The following methods can return different results depending on
how they are called. If the user explicitly calls either
of the \f(CW\*(C`pasv\*(C'\fR or \f(CW\*(C`port\*(C'\fR methods then these methods will
return a \fItrue\fR or \fIfalse\fR value. If the user does not
call either of these methods then the result will be a
reference to a \f(CW\*(C`Net::FTP::dataconn\*(C'\fR based object.
.IP "nlst ( [ \s-1DIR\s0 ] )" 4
.IX Item "nlst ( [ DIR ] )"
Send an \f(CW\*(C`NLST\*(C'\fR command to the server, with an optional parameter.
.IP "list ( [ \s-1DIR\s0 ] )" 4
.IX Item "list ( [ DIR ] )"
Same as \f(CW\*(C`nlst\*(C'\fR but using the \f(CW\*(C`LIST\*(C'\fR command
.IP "retr ( \s-1FILE\s0 )" 4
.IX Item "retr ( FILE )"
Begin the retrieval of a file called \f(CW\*(C`FILE\*(C'\fR from the remote server.
.IP "stor ( \s-1FILE\s0 )" 4
.IX Item "stor ( FILE )"
Tell the server that you wish to store a file. \f(CW\*(C`FILE\*(C'\fR is the
name of the new file that should be created.
.IP "stou ( \s-1FILE\s0 )" 4
.IX Item "stou ( FILE )"
Same as \f(CW\*(C`stor\*(C'\fR but using the \f(CW\*(C`STOU\*(C'\fR command. The name of the unique
file which was created on the server will be available via the \f(CW\*(C`unique_name\*(C'\fR
method after the data connection has been closed.
.IP "appe ( \s-1FILE\s0 )" 4
.IX Item "appe ( FILE )"
Tell the server that we want to append some data to the end of a file
called \f(CW\*(C`FILE\*(C'\fR. If this file does not exist then create it.
.PP
If for some reason you want to have complete control over the data connection,
this includes generating it and calling the \f(CW\*(C`response\*(C'\fR method when required,
then the user can use these methods to do so.
.PP
However calling these methods only affects the use of the methods above that
can return a data connection. They have no effect on methods \f(CW\*(C`get\*(C'\fR, \f(CW\*(C`put\*(C'\fR,
\&\f(CW\*(C`put_unique\*(C'\fR and those that do not require data connections.
.IP "port ( [ \s-1PORT\s0 ] )" 4
.IX Item "port ( [ PORT ] )"
.PD 0
.IP "eprt ( [ \s-1PORT\s0 ] )" 4
.IX Item "eprt ( [ PORT ] )"
.PD
Send a \f(CW\*(C`PORT\*(C'\fR (IPv4) or \f(CW\*(C`EPRT\*(C'\fR (IPv6) command to the server. If \f(CW\*(C`PORT\*(C'\fR 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.
.IP "pasv ()" 4
.IX Item "pasv ()"
.PD 0
.IP "epsv ()" 4
.IX Item "epsv ()"
.PD
Tell the server to go into passive mode (\f(CW\*(C`pasv\*(C'\fR for IPv4, \f(CW\*(C`epsv\*(C'\fR for IPv6).
Returns the text that represents the port on which the server is listening, this
text is in a suitable form to send to another ftp server using the \f(CW\*(C`port\*(C'\fR or
\&\f(CW\*(C`eprt\*(C'\fR method.
.PP
The following methods can be used to transfer files between two remote
servers, providing that these two servers can connect directly to each other.
.IP "pasv_xfer ( \s-1SRC_FILE\s0, \s-1DEST_SERVER\s0 [, \s-1DEST_FILE\s0 ] )" 4
.IX Item "pasv_xfer ( SRC_FILE, DEST_SERVER [, DEST_FILE ] )"
This method will do a file transfer between two remote ftp servers. If
\&\f(CW\*(C`DEST_FILE\*(C'\fR is omitted then the leaf name of \f(CW\*(C`SRC_FILE\*(C'\fR will be used.
.IP "pasv_xfer_unique ( \s-1SRC_FILE\s0, \s-1DEST_SERVER\s0 [, \s-1DEST_FILE\s0 ] )" 4
.IX Item "pasv_xfer_unique ( SRC_FILE, DEST_SERVER [, DEST_FILE ] )"
Like \f(CW\*(C`pasv_xfer\*(C'\fR but the file is stored on the remote server using
the \s-1STOU\s0 command.
.IP "pasv_wait ( \s-1NON_PASV_SERVER\s0 )" 4
.IX Item "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 \f(CW\*(C`Net::FTP\*(C'\fR object for the non-passive server passed as an
argument.
.IP "abort ()" 4
.IX Item "abort ()"
Abort the current data transfer.
.IP "quit ()" 4
.IX Item "quit ()"
Send the \s-1QUIT\s0 command to the remote \s-1FTP\s0 server and close the socket connection.
.SS "Methods for the adventurous"
.IX Subsection "Methods for the adventurous"
.IP "quot (\s-1CMD\s0 [,ARGS])" 4
.IX Item "quot (CMD [,ARGS])"
Send a command, that Net::FTP does not directly support, to the remote
server and wait for a response.
.Sp
Returns most significant digit of the response code.
.Sp
\&\fB\s-1WARNING\s0\fR This call should only be used on commands that do not require
data connections. Misuse of this method can hang the connection.
.IP "can_inet6 ()" 4
.IX Item "can_inet6 ()"
Returns whether we can use IPv6.
.IP "can_ssl ()" 4
.IX Item "can_ssl ()"
Returns whether we can use \s-1SSL\s0.
.SH "THE dataconn CLASS"
.IX Header "THE dataconn CLASS"
Some of the methods defined in \f(CW\*(C`Net::FTP\*(C'\fR return an object which will
be derived from the \f(CW\*(C`Net::FTP::dataconn\*(C'\fR class. See Net::FTP::dataconn for
more details.
.SH "UNIMPLEMENTED"
.IX Header "UNIMPLEMENTED"
The following \s-1RFC959\s0 commands have not been implemented:
.IP "\fB\s-1SMNT\s0\fR" 4
.IX Item "SMNT"
Mount a different file system structure without changing login or
accounting information.
.IP "\fB\s-1HELP\s0\fR" 4
.IX Item "HELP"
Ask the server for \*(L"helpful information\*(R" (that's what the \s-1RFC\s0 says) on
the commands it accepts.
.IP "\fB\s-1MODE\s0\fR" 4
.IX Item "MODE"
Specifies transfer mode (stream, block or compressed) for file to be
transferred.
.IP "\fB\s-1SYST\s0\fR" 4
.IX Item "SYST"
Request remote server system identification.
.IP "\fB\s-1STAT\s0\fR" 4
.IX Item "STAT"
Request remote server status.
.IP "\fB\s-1STRU\s0\fR" 4
.IX Item "STRU"
Specifies file structure for file to be transferred.
.IP "\fB\s-1REIN\s0\fR" 4
.IX Item "REIN"
Reinitialize the connection, flushing all I/O and account information.
.SH "REPORTING BUGS"
.IX Header "REPORTING BUGS"
When reporting bugs/problems please include as much information as possible.
It may be difficult for me to reproduce the problem as almost every setup
is different.
.PP
A small script which yields the problem will probably be of help. It would
also be useful if this script was run with the extra options \f(CW\*(C`Debug => 1\*(C'\fR
passed to the constructor, and the output sent with the bug report. If you
cannot include a small script then please include a Debug trace from a
run of your program which does yield the problem.
.SH "AUTHOR"
.IX Header "AUTHOR"
Graham Barr <\fIgbarr@pobox.com\fR>.
.PP
Steve Hay <\fIshay@cpan.org\fR> is now maintaining libnet as of version
1.22_02.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Net::Netrc,
Net::Cmd,
IO::Socket::SSL
.PP
\&\fIftp\fR\|(1), \fIftpd\fR\|(8), \s-1RFC\s0 959, \s-1RFC\s0 2428, \s-1RFC\s0 4217
http://www.ietf.org/rfc/rfc959.txt
http://www.ietf.org/rfc/rfc2428.txt
http://www.ietf.org/rfc/rfc4217.txt
.SH "USE EXAMPLES"
.IX Header "USE EXAMPLES"
For an example of the use of Net::FTP see
.IP "http://www.csh.rit.edu/~adam/Progs/" 4
.IX Item "http://www.csh.rit.edu/~adam/Progs/"
\&\f(CW\*(C`autoftp\*(C'\fR is a program that can retrieve, send, or list files via
the \s-1FTP\s0 protocol in a non-interactive manner.
.SH "CREDITS"
.IX Header "CREDITS"
Henry Gabryjelski <henryg@WPI.EDU> \- for the suggestion of creating directories
recursively.
.PP
Nathan Torkington <gnat@frii.com> \- for some input on the documentation.
.PP
Roderick Schertler <roderick@gate.net> \- for various inputs
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (C) 1995\-2004 Graham Barr. All rights reserved.
.PP
Copyright (C) 2013\-2017 Steve Hay. All rights reserved.
.SH "LICENCE"
.IX Header "LICENCE"
This module is free software; you can redistribute it and/or modify it under the
same terms as Perl itself, i.e. under the terms of either the \s-1GNU\s0 General Public
License or the Artistic License, as specified in the \fI\s-1LICENCE\s0\fR file.
Copyright 2K16 - 2K18 Indonesian Hacker Rulez