| 1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
| 2 | .\" |
| 3 | .\" Standard preamble: |
| 4 | .\" ======================================================================== |
| 5 | .de Sh \" Subsection heading |
| 6 | .br |
| 7 | .if t .Sp |
| 8 | .ne 5 |
| 9 | .PP |
| 10 | \fB\\$1\fR |
| 11 | .PP |
| 12 | .. |
| 13 | .de Sp \" Vertical space (when we can't use .PP) |
| 14 | .if t .sp .5v |
| 15 | .if n .sp |
| 16 | .. |
| 17 | .de Vb \" Begin verbatim text |
| 18 | .ft CW |
| 19 | .nf |
| 20 | .ne \\$1 |
| 21 | .. |
| 22 | .de Ve \" End verbatim text |
| 23 | .ft R |
| 24 | .fi |
| 25 | .. |
| 26 | .\" Set up some character translations and predefined strings. \*(-- will |
| 27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left |
| 28 | .\" double quote, and \*(R" will give a right double quote. | will give a |
| 29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to |
| 30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' |
| 31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. |
| 32 | .tr \(*W-|\(bv\*(Tr |
| 33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' |
| 34 | .ie n \{\ |
| 35 | . ds -- \(*W- |
| 36 | . ds PI pi |
| 37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch |
| 38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch |
| 39 | . ds L" "" |
| 40 | . ds R" "" |
| 41 | . ds C` "" |
| 42 | . ds C' "" |
| 43 | 'br\} |
| 44 | .el\{\ |
| 45 | . ds -- \|\(em\| |
| 46 | . ds PI \(*p |
| 47 | . ds L" `` |
| 48 | . ds R" '' |
| 49 | 'br\} |
| 50 | .\" |
| 51 | .\" If the F register is turned on, we'll generate index entries on stderr for |
| 52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index |
| 53 | .\" entries marked with X<> in POD. Of course, you'll have to process the |
| 54 | .\" output yourself in some meaningful fashion. |
| 55 | .if \nF \{\ |
| 56 | . de IX |
| 57 | . tm Index:\\$1\t\\n%\t"\\$2" |
| 58 | .. |
| 59 | . nr % 0 |
| 60 | . rr F |
| 61 | .\} |
| 62 | .\" |
| 63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 64 | .\" way too many mistakes in technical documents. |
| 65 | .hy 0 |
| 66 | .if n .na |
| 67 | .\" |
| 68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). |
| 69 | .\" Fear. Run. Save yourself. No user-serviceable parts. |
| 70 | . \" fudge factors for nroff and troff |
| 71 | .if n \{\ |
| 72 | . ds #H 0 |
| 73 | . ds #V .8m |
| 74 | . ds #F .3m |
| 75 | . ds #[ \f1 |
| 76 | . ds #] \fP |
| 77 | .\} |
| 78 | .if t \{\ |
| 79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) |
| 80 | . ds #V .6m |
| 81 | . ds #F 0 |
| 82 | . ds #[ \& |
| 83 | . ds #] \& |
| 84 | .\} |
| 85 | . \" simple accents for nroff and troff |
| 86 | .if n \{\ |
| 87 | . ds ' \& |
| 88 | . ds ` \& |
| 89 | . ds ^ \& |
| 90 | . ds , \& |
| 91 | . ds ~ ~ |
| 92 | . ds / |
| 93 | .\} |
| 94 | .if t \{\ |
| 95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" |
| 96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' |
| 97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' |
| 98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' |
| 99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' |
| 100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' |
| 101 | .\} |
| 102 | . \" troff and (daisy-wheel) nroff accents |
| 103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' |
| 104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' |
| 105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] |
| 106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' |
| 107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' |
| 108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] |
| 109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] |
| 110 | .ds ae a\h'-(\w'a'u*4/10)'e |
| 111 | .ds Ae A\h'-(\w'A'u*4/10)'E |
| 112 | . \" corrections for vroff |
| 113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' |
| 114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' |
| 115 | . \" for low resolution devices (crt and lpr) |
| 116 | .if \n(.H>23 .if \n(.V>19 \ |
| 117 | \{\ |
| 118 | . ds : e |
| 119 | . ds 8 ss |
| 120 | . ds o a |
| 121 | . ds d- d\h'-1'\(ga |
| 122 | . ds D- D\h'-1'\(hy |
| 123 | . ds th \o'bp' |
| 124 | . ds Th \o'LP' |
| 125 | . ds ae ae |
| 126 | . ds Ae AE |
| 127 | .\} |
| 128 | .rm #[ #] #H #V #F C |
| 129 | .\" ======================================================================== |
| 130 | .\" |
| 131 | .IX Title "Net::FTP 3" |
| 132 | .TH Net::FTP 3 "2002-06-01" "perl v5.8.0" "Perl Programmers Reference Guide" |
| 133 | .SH "NAME" |
| 134 | Net::FTP \- FTP Client class |
| 135 | .SH "SYNOPSIS" |
| 136 | .IX Header "SYNOPSIS" |
| 137 | .Vb 1 |
| 138 | \& use Net::FTP; |
| 139 | .Ve |
| 140 | .PP |
| 141 | .Vb 5 |
| 142 | \& $ftp = Net::FTP->new("some.host.name", Debug => 0); |
| 143 | \& $ftp->login("anonymous",'-anonymous@'); |
| 144 | \& $ftp->cwd("/pub"); |
| 145 | \& $ftp->get("that.file"); |
| 146 | \& $ftp->quit; |
| 147 | .Ve |
| 148 | .SH "DESCRIPTION" |
| 149 | .IX Header "DESCRIPTION" |
| 150 | \&\f(CW\*(C`Net::FTP\*(C'\fR is a class implementing a simple \s-1FTP\s0 client in Perl as |
| 151 | described in \s-1RFC959\s0. It provides wrappers for a subset of the \s-1RFC959\s0 |
| 152 | commands. |
| 153 | .SH "OVERVIEW" |
| 154 | .IX Header "OVERVIEW" |
| 155 | \&\s-1FTP\s0 stands for File Transfer Protocol. It is a way of transferring |
| 156 | files between networked machines. The protocol defines a client |
| 157 | (whose commands are provided by this module) and a server (not |
| 158 | implemented in this module). Communication is always initiated by the |
| 159 | client, and the server responds with a message and a status code (and |
| 160 | sometimes with data). |
| 161 | .PP |
| 162 | The \s-1FTP\s0 protocol allows files to be sent to or fetched from the |
| 163 | server. Each transfer involves a \fBlocal file\fR (on the client) and a |
| 164 | \&\fBremote file\fR (on the server). In this module, the same file name |
| 165 | will be used for both local and remote if only one is specified. This |
| 166 | means that transferring remote file \f(CW\*(C`/path/to/file\*(C'\fR will try to put |
| 167 | that file in \f(CW\*(C`/path/to/file\*(C'\fR locally, unless you specify a local file |
| 168 | name. |
| 169 | .PP |
| 170 | The protocol also defines several standard \fBtranslations\fR which the |
| 171 | file can undergo during transfer. These are \s-1ASCII\s0, \s-1EBCDIC\s0, binary, |
| 172 | and byte. \s-1ASCII\s0 is the default type, and indicates that the sender of |
| 173 | files will translate the ends of lines to a standard representation |
| 174 | which the receiver will then translate back into their local |
| 175 | representation. \s-1EBCDIC\s0 indicates the file being transferred is in |
| 176 | \&\s-1EBCDIC\s0 format. Binary (also known as image) format sends the data as |
| 177 | a contiguous bit stream. Byte format transfers the data as bytes, the |
| 178 | values of which remain the same regardless of differences in byte size |
| 179 | between the two machines (in theory \- in practice you should only use |
| 180 | this if you really know what you're doing). |
| 181 | .SH "CONSTRUCTOR" |
| 182 | .IX Header "CONSTRUCTOR" |
| 183 | .IP "new (\s-1HOST\s0 [,OPTIONS])" 4 |
| 184 | .IX Item "new (HOST [,OPTIONS])" |
| 185 | This is the constructor for a new Net::FTP object. \f(CW\*(C`HOST\*(C'\fR is the |
| 186 | name of the remote host to which an \s-1FTP\s0 connection is required. |
| 187 | .Sp |
| 188 | \&\f(CW\*(C`OPTIONS\*(C'\fR are passed in a hash like fashion, using key and value pairs. |
| 189 | Possible options are: |
| 190 | .Sp |
| 191 | \&\fBFirewall\fR \- The name of a machine which acts as an \s-1FTP\s0 firewall. This can be |
| 192 | overridden by an environment variable \f(CW\*(C`FTP_FIREWALL\*(C'\fR. If specified, and the |
| 193 | given host cannot be directly connected to, then the |
| 194 | connection is made to the firewall machine and the string \f(CW@hostname\fR is |
| 195 | appended to the login identifier. This kind of setup is also refered to |
| 196 | as an ftp proxy. |
| 197 | .Sp |
| 198 | \&\fBFirewallType\fR \- The type of firewall running on the machine indicated by |
| 199 | \&\fBFirewall\fR. This can be overridden by an environment variable |
| 200 | \&\f(CW\*(C`FTP_FIREWALL_TYPE\*(C'\fR. For a list of permissible types, see the description of |
| 201 | ftp_firewall_type in Net::Config. |
| 202 | .Sp |
| 203 | \&\fBBlockSize\fR \- This is the block size that Net::FTP will use when doing |
| 204 | transfers. (defaults to 10240) |
| 205 | .Sp |
| 206 | \&\fBPort\fR \- The port number to connect to on the remote machine for the |
| 207 | \&\s-1FTP\s0 connection |
| 208 | .Sp |
| 209 | \&\fBTimeout\fR \- Set a timeout value (defaults to 120) |
| 210 | .Sp |
| 211 | \&\fBDebug\fR \- debug level (see the debug method in Net::Cmd) |
| 212 | .Sp |
| 213 | \&\fBPassive\fR \- If set to a non-zero value then all data transfers will be done |
| 214 | using passive mode. This is not usually required except for some \fIdumb\fR |
| 215 | servers, and some firewall configurations. This can also be set by the |
| 216 | environment variable \f(CW\*(C`FTP_PASSIVE\*(C'\fR. |
| 217 | .Sp |
| 218 | \&\fBHash\fR \- If given a reference to a file handle (e.g., \f(CW\*(C`\e*STDERR\*(C'\fR), |
| 219 | print hash marks (#) on that filehandle every 1024 bytes. This |
| 220 | simply invokes the \f(CW\*(C`hash()\*(C'\fR method for you, so that hash marks |
| 221 | are displayed for all transfers. You can, of course, call \f(CW\*(C`hash()\*(C'\fR |
| 222 | explicitly whenever you'd like. |
| 223 | .Sp |
| 224 | If the constructor fails undef will be returned and an error message will |
| 225 | be in $@ |
| 226 | .SH "METHODS" |
| 227 | .IX Header "METHODS" |
| 228 | Unless otherwise stated all methods return either a \fItrue\fR or \fIfalse\fR |
| 229 | value, with \fItrue\fR meaning that the operation was a success. When a method |
| 230 | states that it returns a value, failure will be returned as \fIundef\fR or an |
| 231 | empty list. |
| 232 | .IP "login ([\s-1LOGIN\s0 [,PASSWORD [, \s-1ACCOUNT\s0] ] ])" 4 |
| 233 | .IX Item "login ([LOGIN [,PASSWORD [, ACCOUNT] ] ])" |
| 234 | Log into the remote \s-1FTP\s0 server with the given login information. If |
| 235 | no arguments are given then the \f(CW\*(C`Net::FTP\*(C'\fR uses the \f(CW\*(C`Net::Netrc\*(C'\fR |
| 236 | package to lookup the login information for the connected host. |
| 237 | If no information is found then a login of \fIanonymous\fR is used. |
| 238 | If no password is given and the login is \fIanonymous\fR then \fIanonymous@\fR |
| 239 | will be used for password. |
| 240 | .Sp |
| 241 | If the connection is via a firewall then the \f(CW\*(C`authorize\*(C'\fR method will |
| 242 | be called with no arguments. |
| 243 | .IP "authorize ( [\s-1AUTH\s0 [, \s-1RESP\s0]])" 4 |
| 244 | .IX Item "authorize ( [AUTH [, RESP]])" |
| 245 | This is a protocol used by some firewall ftp proxies. It is used |
| 246 | to authorise the user to send data out. If both arguments are not specified |
| 247 | then \f(CW\*(C`authorize\*(C'\fR uses \f(CW\*(C`Net::Netrc\*(C'\fR to do a lookup. |
| 248 | .IP "site (\s-1ARGS\s0)" 4 |
| 249 | .IX Item "site (ARGS)" |
| 250 | Send a \s-1SITE\s0 command to the remote server and wait for a response. |
| 251 | .Sp |
| 252 | Returns most significant digit of the response code. |
| 253 | .IP "type (\s-1TYPE\s0 [, \s-1ARGS\s0])" 4 |
| 254 | .IX Item "type (TYPE [, ARGS])" |
| 255 | This method will send the \s-1TYPE\s0 command to the remote \s-1FTP\s0 server |
| 256 | to change the type of data transfer. The return value is the previous |
| 257 | value. |
| 258 | .IP "ascii ([\s-1ARGS\s0]) binary([\s-1ARGS\s0]) ebcdic([\s-1ARGS\s0]) byte([\s-1ARGS\s0])" 4 |
| 259 | .IX Item "ascii ([ARGS]) binary([ARGS]) ebcdic([ARGS]) byte([ARGS])" |
| 260 | Synonyms for \f(CW\*(C`type\*(C'\fR with the first arguments set correctly |
| 261 | .Sp |
| 262 | \&\fB\s-1NOTE\s0\fR ebcdic and byte are not fully supported. |
| 263 | .IP "rename ( \s-1OLDNAME\s0, \s-1NEWNAME\s0 )" 4 |
| 264 | .IX Item "rename ( OLDNAME, NEWNAME )" |
| 265 | 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 |
| 266 | is done by sending the \s-1RNFR\s0 and \s-1RNTO\s0 commands. |
| 267 | .IP "delete ( \s-1FILENAME\s0 )" 4 |
| 268 | .IX Item "delete ( FILENAME )" |
| 269 | Send a request to the server to delete \f(CW\*(C`FILENAME\*(C'\fR. |
| 270 | .IP "cwd ( [ \s-1DIR\s0 ] )" 4 |
| 271 | .IX Item "cwd ( [ DIR ] )" |
| 272 | Attempt to change directory to the directory given in \f(CW$dir\fR. If |
| 273 | \&\f(CW$dir\fR is \f(CW".."\fR, the \s-1FTP\s0 \f(CW\*(C`CDUP\*(C'\fR command is used to attempt to |
| 274 | move up one directory. If no directory is given then an attempt is made |
| 275 | to change the directory to the root directory. |
| 276 | .IP "cdup ()" 4 |
| 277 | .IX Item "cdup ()" |
| 278 | Change directory to the parent of the current directory. |
| 279 | .IP "pwd ()" 4 |
| 280 | .IX Item "pwd ()" |
| 281 | Returns the full pathname of the current directory. |
| 282 | .IP "restart ( \s-1WHERE\s0 )" 4 |
| 283 | .IX Item "restart ( WHERE )" |
| 284 | Set the byte offset at which to begin the next data transfer. Net::FTP simply |
| 285 | records this value and uses it when during the next data transfer. For this |
| 286 | reason this method will not return an error, but setting it may cause |
| 287 | a subsequent data transfer to fail. |
| 288 | .IP "rmdir ( \s-1DIR\s0 )" 4 |
| 289 | .IX Item "rmdir ( DIR )" |
| 290 | Remove the directory with the name \f(CW\*(C`DIR\*(C'\fR. |
| 291 | .IP "mkdir ( \s-1DIR\s0 [, \s-1RECURSE\s0 ])" 4 |
| 292 | .IX Item "mkdir ( DIR [, RECURSE ])" |
| 293 | Create a new directory with the name \f(CW\*(C`DIR\*(C'\fR. If \f(CW\*(C`RECURSE\*(C'\fR is \fItrue\fR then |
| 294 | \&\f(CW\*(C`mkdir\*(C'\fR will attempt to create all the directories in the given path. |
| 295 | .Sp |
| 296 | Returns the full pathname to the new directory. |
| 297 | .IP "ls ( [ \s-1DIR\s0 ] )" 4 |
| 298 | .IX Item "ls ( [ DIR ] )" |
| 299 | Get a directory listing of \f(CW\*(C`DIR\*(C'\fR, or the current directory. |
| 300 | .Sp |
| 301 | In an array context, returns a list of lines returned from the server. In |
| 302 | a scalar context, returns a reference to a list. |
| 303 | .IP "dir ( [ \s-1DIR\s0 ] )" 4 |
| 304 | .IX Item "dir ( [ DIR ] )" |
| 305 | Get a directory listing of \f(CW\*(C`DIR\*(C'\fR, or the current directory in long format. |
| 306 | .Sp |
| 307 | In an array context, returns a list of lines returned from the server. In |
| 308 | a scalar context, returns a reference to a list. |
| 309 | .IP "get ( \s-1REMOTE_FILE\s0 [, \s-1LOCAL_FILE\s0 [, \s-1WHERE\s0]] )" 4 |
| 310 | .IX Item "get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] )" |
| 311 | Get \f(CW\*(C`REMOTE_FILE\*(C'\fR from the server and store locally. \f(CW\*(C`LOCAL_FILE\*(C'\fR may be |
| 312 | a filename or a filehandle. If not specified, the file will be stored in |
| 313 | the current directory with the same leafname as the remote file. |
| 314 | .Sp |
| 315 | If \f(CW\*(C`WHERE\*(C'\fR is given then the first \f(CW\*(C`WHERE\*(C'\fR bytes of the file will |
| 316 | not be transfered, and the remaining bytes will be appended to |
| 317 | the local file if it already exists. |
| 318 | .Sp |
| 319 | Returns \f(CW\*(C`LOCAL_FILE\*(C'\fR, or the generated local file name if \f(CW\*(C`LOCAL_FILE\*(C'\fR |
| 320 | is not given. If an error was encountered undef is returned. |
| 321 | .IP "put ( \s-1LOCAL_FILE\s0 [, \s-1REMOTE_FILE\s0 ] )" 4 |
| 322 | .IX Item "put ( LOCAL_FILE [, REMOTE_FILE ] )" |
| 323 | Put a file on the remote server. \f(CW\*(C`LOCAL_FILE\*(C'\fR may be a name or a filehandle. |
| 324 | If \f(CW\*(C`LOCAL_FILE\*(C'\fR is a filehandle then \f(CW\*(C`REMOTE_FILE\*(C'\fR must be specified. If |
| 325 | \&\f(CW\*(C`REMOTE_FILE\*(C'\fR is not specified then the file will be stored in the current |
| 326 | directory with the same leafname as \f(CW\*(C`LOCAL_FILE\*(C'\fR. |
| 327 | .Sp |
| 328 | Returns \f(CW\*(C`REMOTE_FILE\*(C'\fR, or the generated remote filename if \f(CW\*(C`REMOTE_FILE\*(C'\fR |
| 329 | is not given. |
| 330 | .Sp |
| 331 | \&\fB\s-1NOTE\s0\fR: If for some reason the transfer does not complete and an error is |
| 332 | returned then the contents that had been transfered will not be remove |
| 333 | automatically. |
| 334 | .IP "put_unique ( \s-1LOCAL_FILE\s0 [, \s-1REMOTE_FILE\s0 ] )" 4 |
| 335 | .IX Item "put_unique ( LOCAL_FILE [, REMOTE_FILE ] )" |
| 336 | Same as put but uses the \f(CW\*(C`STOU\*(C'\fR command. |
| 337 | .Sp |
| 338 | Returns the name of the file on the server. |
| 339 | .IP "append ( \s-1LOCAL_FILE\s0 [, \s-1REMOTE_FILE\s0 ] )" 4 |
| 340 | .IX Item "append ( LOCAL_FILE [, REMOTE_FILE ] )" |
| 341 | Same as put but appends to the file on the remote server. |
| 342 | .Sp |
| 343 | Returns \f(CW\*(C`REMOTE_FILE\*(C'\fR, or the generated remote filename if \f(CW\*(C`REMOTE_FILE\*(C'\fR |
| 344 | is not given. |
| 345 | .IP "unique_name ()" 4 |
| 346 | .IX Item "unique_name ()" |
| 347 | Returns the name of the last file stored on the server using the |
| 348 | \&\f(CW\*(C`STOU\*(C'\fR command. |
| 349 | .IP "mdtm ( \s-1FILE\s0 )" 4 |
| 350 | .IX Item "mdtm ( FILE )" |
| 351 | Returns the \fImodification time\fR of the given file |
| 352 | .IP "size ( \s-1FILE\s0 )" 4 |
| 353 | .IX Item "size ( FILE )" |
| 354 | Returns the size in bytes for the given file as stored on the remote server. |
| 355 | .Sp |
| 356 | \&\fB\s-1NOTE\s0\fR: The size reported is the size of the stored file on the remote server. |
| 357 | If the file is subsequently transfered from the server in \s-1ASCII\s0 mode |
| 358 | and the remote server and local machine have different ideas about |
| 359 | \&\*(L"End Of Line\*(R" then the size of file on the local machine after transfer |
| 360 | may be different. |
| 361 | .IP "supported ( \s-1CMD\s0 )" 4 |
| 362 | .IX Item "supported ( CMD )" |
| 363 | Returns \s-1TRUE\s0 if the remote server supports the given command. |
| 364 | .IP "hash ( [\s-1FILEHANDLE_GLOB_REF\s0],[ \s-1BYTES_PER_HASH_MARK\s0] )" 4 |
| 365 | .IX Item "hash ( [FILEHANDLE_GLOB_REF],[ BYTES_PER_HASH_MARK] )" |
| 366 | Called without parameters, or with the first argument false, hash marks |
| 367 | are suppressed. If the first argument is true but not a reference to a |
| 368 | file handle glob, then \e*STDERR is used. The second argument is the number |
| 369 | of bytes per hash mark printed, and defaults to 1024. In all cases the |
| 370 | return value is a reference to an array of two: the filehandle glob reference |
| 371 | and the bytes per hash mark. |
| 372 | .PP |
| 373 | The following methods can return different results depending on |
| 374 | how they are called. If the user explicitly calls either |
| 375 | of the \f(CW\*(C`pasv\*(C'\fR or \f(CW\*(C`port\*(C'\fR methods then these methods will |
| 376 | return a \fItrue\fR or \fIfalse\fR value. If the user does not |
| 377 | call either of these methods then the result will be a |
| 378 | reference to a \f(CW\*(C`Net::FTP::dataconn\*(C'\fR based object. |
| 379 | .IP "nlst ( [ \s-1DIR\s0 ] )" 4 |
| 380 | .IX Item "nlst ( [ DIR ] )" |
| 381 | Send an \f(CW\*(C`NLST\*(C'\fR command to the server, with an optional parameter. |
| 382 | .IP "list ( [ \s-1DIR\s0 ] )" 4 |
| 383 | .IX Item "list ( [ DIR ] )" |
| 384 | Same as \f(CW\*(C`nlst\*(C'\fR but using the \f(CW\*(C`LIST\*(C'\fR command |
| 385 | .IP "retr ( \s-1FILE\s0 )" 4 |
| 386 | .IX Item "retr ( FILE )" |
| 387 | Begin the retrieval of a file called \f(CW\*(C`FILE\*(C'\fR from the remote server. |
| 388 | .IP "stor ( \s-1FILE\s0 )" 4 |
| 389 | .IX Item "stor ( FILE )" |
| 390 | Tell the server that you wish to store a file. \f(CW\*(C`FILE\*(C'\fR is the |
| 391 | name of the new file that should be created. |
| 392 | .IP "stou ( \s-1FILE\s0 )" 4 |
| 393 | .IX Item "stou ( FILE )" |
| 394 | Same as \f(CW\*(C`stor\*(C'\fR but using the \f(CW\*(C`STOU\*(C'\fR command. The name of the unique |
| 395 | file which was created on the server will be available via the \f(CW\*(C`unique_name\*(C'\fR |
| 396 | method after the data connection has been closed. |
| 397 | .IP "appe ( \s-1FILE\s0 )" 4 |
| 398 | .IX Item "appe ( FILE )" |
| 399 | Tell the server that we want to append some data to the end of a file |
| 400 | called \f(CW\*(C`FILE\*(C'\fR. If this file does not exist then create it. |
| 401 | .PP |
| 402 | If for some reason you want to have complete control over the data connection, |
| 403 | this includes generating it and calling the \f(CW\*(C`response\*(C'\fR method when required, |
| 404 | then the user can use these methods to do so. |
| 405 | .PP |
| 406 | However calling these methods only affects the use of the methods above that |
| 407 | can return a data connection. They have no effect on methods \f(CW\*(C`get\*(C'\fR, \f(CW\*(C`put\*(C'\fR, |
| 408 | \&\f(CW\*(C`put_unique\*(C'\fR and those that do not require data connections. |
| 409 | .IP "port ( [ \s-1PORT\s0 ] )" 4 |
| 410 | .IX Item "port ( [ PORT ] )" |
| 411 | Send a \f(CW\*(C`PORT\*(C'\fR command to the server. If \f(CW\*(C`PORT\*(C'\fR is specified then it is sent |
| 412 | to the server. If not, then a listen socket is created and the correct information |
| 413 | sent to the server. |
| 414 | .IP "pasv ()" 4 |
| 415 | .IX Item "pasv ()" |
| 416 | Tell the server to go into passive mode. Returns the text that represents the |
| 417 | port on which the server is listening, this text is in a suitable form to |
| 418 | sent to another ftp server using the \f(CW\*(C`port\*(C'\fR method. |
| 419 | .PP |
| 420 | The following methods can be used to transfer files between two remote |
| 421 | servers, providing that these two servers can connect directly to each other. |
| 422 | .IP "pasv_xfer ( \s-1SRC_FILE\s0, \s-1DEST_SERVER\s0 [, \s-1DEST_FILE\s0 ] )" 4 |
| 423 | .IX Item "pasv_xfer ( SRC_FILE, DEST_SERVER [, DEST_FILE ] )" |
| 424 | This method will do a file transfer between two remote ftp servers. If |
| 425 | \&\f(CW\*(C`DEST_FILE\*(C'\fR is omitted then the leaf name of \f(CW\*(C`SRC_FILE\*(C'\fR will be used. |
| 426 | .IP "pasv_xfer_unique ( \s-1SRC_FILE\s0, \s-1DEST_SERVER\s0 [, \s-1DEST_FILE\s0 ] )" 4 |
| 427 | .IX Item "pasv_xfer_unique ( SRC_FILE, DEST_SERVER [, DEST_FILE ] )" |
| 428 | Like \f(CW\*(C`pasv_xfer\*(C'\fR but the file is stored on the remote server using |
| 429 | the \s-1STOU\s0 command. |
| 430 | .IP "pasv_wait ( \s-1NON_PASV_SERVER\s0 )" 4 |
| 431 | .IX Item "pasv_wait ( NON_PASV_SERVER )" |
| 432 | This method can be used to wait for a transfer to complete between a passive |
| 433 | server and a non-passive server. The method should be called on the passive |
| 434 | server with the \f(CW\*(C`Net::FTP\*(C'\fR object for the non-passive server passed as an |
| 435 | argument. |
| 436 | .IP "abort ()" 4 |
| 437 | .IX Item "abort ()" |
| 438 | Abort the current data transfer. |
| 439 | .IP "quit ()" 4 |
| 440 | .IX Item "quit ()" |
| 441 | Send the \s-1QUIT\s0 command to the remote \s-1FTP\s0 server and close the socket connection. |
| 442 | .Sh "Methods for the adventurous" |
| 443 | .IX Subsection "Methods for the adventurous" |
| 444 | \&\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 |
| 445 | be used to send commands to the remote \s-1FTP\s0 server. |
| 446 | .IP "quot (\s-1CMD\s0 [,ARGS])" 4 |
| 447 | .IX Item "quot (CMD [,ARGS])" |
| 448 | Send a command, that Net::FTP does not directly support, to the remote |
| 449 | server and wait for a response. |
| 450 | .Sp |
| 451 | Returns most significant digit of the response code. |
| 452 | .Sp |
| 453 | \&\fB\s-1WARNING\s0\fR This call should only be used on commands that do not require |
| 454 | data connections. Misuse of this method can hang the connection. |
| 455 | .SH "THE dataconn CLASS" |
| 456 | .IX Header "THE dataconn CLASS" |
| 457 | Some of the methods defined in \f(CW\*(C`Net::FTP\*(C'\fR return an object which will |
| 458 | be derived from this class.The dataconn class itself is derived from |
| 459 | the \f(CW\*(C`IO::Socket::INET\*(C'\fR class, so any normal \s-1IO\s0 operations can be performed. |
| 460 | However the following methods are defined in the dataconn class and \s-1IO\s0 should |
| 461 | be performed using these. |
| 462 | .IP "read ( \s-1BUFFER\s0, \s-1SIZE\s0 [, \s-1TIMEOUT\s0 ] )" 4 |
| 463 | .IX Item "read ( BUFFER, SIZE [, TIMEOUT ] )" |
| 464 | Read \f(CW\*(C`SIZE\*(C'\fR bytes of data from the server and place it into \f(CW\*(C`BUFFER\*(C'\fR, also |
| 465 | performing any <\s-1CRLF\s0> translation necessary. \f(CW\*(C`TIMEOUT\*(C'\fR is optional, if not |
| 466 | given, the timeout value from the command connection will be used. |
| 467 | .Sp |
| 468 | Returns the number of bytes read before any <\s-1CRLF\s0> translation. |
| 469 | .IP "write ( \s-1BUFFER\s0, \s-1SIZE\s0 [, \s-1TIMEOUT\s0 ] )" 4 |
| 470 | .IX Item "write ( BUFFER, SIZE [, TIMEOUT ] )" |
| 471 | Write \f(CW\*(C`SIZE\*(C'\fR bytes of data from \f(CW\*(C`BUFFER\*(C'\fR to the server, also |
| 472 | performing any <\s-1CRLF\s0> translation necessary. \f(CW\*(C`TIMEOUT\*(C'\fR is optional, if not |
| 473 | given, the timeout value from the command connection will be used. |
| 474 | .Sp |
| 475 | Returns the number of bytes written before any <\s-1CRLF\s0> translation. |
| 476 | .IP "bytes_read ()" 4 |
| 477 | .IX Item "bytes_read ()" |
| 478 | Returns the number of bytes read so far. |
| 479 | .IP "abort ()" 4 |
| 480 | .IX Item "abort ()" |
| 481 | Abort the current data transfer. |
| 482 | .IP "close ()" 4 |
| 483 | .IX Item "close ()" |
| 484 | Close the data connection and get a response from the \s-1FTP\s0 server. Returns |
| 485 | \&\fItrue\fR if the connection was closed successfully and the first digit of |
| 486 | the response from the server was a '2'. |
| 487 | .SH "UNIMPLEMENTED" |
| 488 | .IX Header "UNIMPLEMENTED" |
| 489 | The following \s-1RFC959\s0 commands have not been implemented: |
| 490 | .IP "\fB\s-1ALLO\s0\fR" 4 |
| 491 | .IX Item "ALLO" |
| 492 | Allocates storage for the file to be transferred. |
| 493 | .IP "\fB\s-1SMNT\s0\fR" 4 |
| 494 | .IX Item "SMNT" |
| 495 | Mount a different file system structure without changing login or |
| 496 | accounting information. |
| 497 | .IP "\fB\s-1HELP\s0\fR" 4 |
| 498 | .IX Item "HELP" |
| 499 | Ask the server for \*(L"helpful information\*(R" (that's what the \s-1RFC\s0 says) on |
| 500 | the commands it accepts. |
| 501 | .IP "\fB\s-1MODE\s0\fR" 4 |
| 502 | .IX Item "MODE" |
| 503 | Specifies transfer mode (stream, block or compressed) for file to be |
| 504 | transferred. |
| 505 | .IP "\fB\s-1SYST\s0\fR" 4 |
| 506 | .IX Item "SYST" |
| 507 | Request remote server system identification. |
| 508 | .IP "\fB\s-1STAT\s0\fR" 4 |
| 509 | .IX Item "STAT" |
| 510 | Request remote server status. |
| 511 | .IP "\fB\s-1STRU\s0\fR" 4 |
| 512 | .IX Item "STRU" |
| 513 | Specifies file structure for file to be transferred. |
| 514 | .IP "\fB\s-1REIN\s0\fR" 4 |
| 515 | .IX Item "REIN" |
| 516 | Reinitialize the connection, flushing all I/O and account information. |
| 517 | .SH "REPORTING BUGS" |
| 518 | .IX Header "REPORTING BUGS" |
| 519 | When reporting bugs/problems please include as much information as possible. |
| 520 | It may be difficult for me to reproduce the problem as almost every setup |
| 521 | is different. |
| 522 | .PP |
| 523 | A small script which yields the problem will probably be of help. It would |
| 524 | also be useful if this script was run with the extra options \f(CW\*(C`Debug =\*(C'\fR 1> |
| 525 | passed to the constructor, and the output sent with the bug report. If you |
| 526 | cannot include a small script then please include a Debug trace from a |
| 527 | run of your program which does yield the problem. |
| 528 | .SH "AUTHOR" |
| 529 | .IX Header "AUTHOR" |
| 530 | Graham Barr <gbarr@pobox.com> |
| 531 | .SH "SEE ALSO" |
| 532 | .IX Header "SEE ALSO" |
| 533 | Net::Netrc |
| 534 | Net::Cmd |
| 535 | .PP |
| 536 | \&\fIftp\fR\|(1), \fIftpd\fR\|(8), \s-1RFC\s0 959 |
| 537 | http://www.cis.ohio\-state.edu/htbin/rfc/rfc959.html |
| 538 | .SH "USE EXAMPLES" |
| 539 | .IX Header "USE EXAMPLES" |
| 540 | For an example of the use of Net::FTP see |
| 541 | .IP "http://www.csh.rit.edu/~adam/Progs/autoftp\-2.0.tar.gz" 4 |
| 542 | .IX Item "http://www.csh.rit.edu/~adam/Progs/autoftp-2.0.tar.gz" |
| 543 | \&\f(CW\*(C`autoftp\*(C'\fR is a program that can retrieve, send, or list files via |
| 544 | the \s-1FTP\s0 protocol in a non-interactive manner. |
| 545 | .SH "CREDITS" |
| 546 | .IX Header "CREDITS" |
| 547 | Henry Gabryjelski <henryg@WPI.EDU> \- for the suggestion of creating directories |
| 548 | recursively. |
| 549 | .PP |
| 550 | Nathan Torkington <gnat@frii.com> \- for some input on the documentation. |
| 551 | .PP |
| 552 | Roderick Schertler <roderick@gate.net> \- for various inputs |
| 553 | .SH "COPYRIGHT" |
| 554 | .IX Header "COPYRIGHT" |
| 555 | Copyright (c) 1995\-1998 Graham Barr. All rights reserved. |
| 556 | This program is free software; you can redistribute it and/or modify it |
| 557 | under the same terms as Perl itself. |
| 558 | .PP |
| 559 | \&\fI$Id: //depot/libnet/Net/FTP.pm#68 $\fR |