Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 |
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 "2001-09-21" "perl v5.8.8" "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 2 | |
142 | \& $ftp = Net::FTP->new("some.host.name", Debug => 0) | |
143 | \& or die "Cannot connect to some.host.name: $@"; | |
144 | .Ve | |
145 | .PP | |
146 | .Vb 2 | |
147 | \& $ftp->login("anonymous",'-anonymous@') | |
148 | \& or die "Cannot login ", $ftp->message; | |
149 | .Ve | |
150 | .PP | |
151 | .Vb 2 | |
152 | \& $ftp->cwd("/pub") | |
153 | \& or die "Cannot change working directory ", $ftp->message; | |
154 | .Ve | |
155 | .PP | |
156 | .Vb 2 | |
157 | \& $ftp->get("that.file") | |
158 | \& or die "get failed ", $ftp->message; | |
159 | .Ve | |
160 | .PP | |
161 | .Vb 1 | |
162 | \& $ftp->quit; | |
163 | .Ve | |
164 | .SH "DESCRIPTION" | |
165 | .IX Header "DESCRIPTION" | |
166 | \&\f(CW\*(C`Net::FTP\*(C'\fR is a class implementing a simple \s-1FTP\s0 client in Perl as | |
167 | described in \s-1RFC959\s0. It provides wrappers for a subset of the \s-1RFC959\s0 | |
168 | commands. | |
169 | .SH "OVERVIEW" | |
170 | .IX Header "OVERVIEW" | |
171 | \&\s-1FTP\s0 stands for File Transfer Protocol. It is a way of transferring | |
172 | files between networked machines. The protocol defines a client | |
173 | (whose commands are provided by this module) and a server (not | |
174 | implemented in this module). Communication is always initiated by the | |
175 | client, and the server responds with a message and a status code (and | |
176 | sometimes with data). | |
177 | .PP | |
178 | The \s-1FTP\s0 protocol allows files to be sent to or fetched from the | |
179 | server. Each transfer involves a \fBlocal file\fR (on the client) and a | |
180 | \&\fBremote file\fR (on the server). In this module, the same file name | |
181 | will be used for both local and remote if only one is specified. This | |
182 | means that transferring remote file \f(CW\*(C`/path/to/file\*(C'\fR will try to put | |
183 | that file in \f(CW\*(C`/path/to/file\*(C'\fR locally, unless you specify a local file | |
184 | name. | |
185 | .PP | |
186 | The protocol also defines several standard \fBtranslations\fR which the | |
187 | file can undergo during transfer. These are \s-1ASCII\s0, \s-1EBCDIC\s0, binary, | |
188 | and byte. \s-1ASCII\s0 is the default type, and indicates that the sender of | |
189 | files will translate the ends of lines to a standard representation | |
190 | which the receiver will then translate back into their local | |
191 | representation. \s-1EBCDIC\s0 indicates the file being transferred is in | |
192 | \&\s-1EBCDIC\s0 format. Binary (also known as image) format sends the data as | |
193 | a contiguous bit stream. Byte format transfers the data as bytes, the | |
194 | values of which remain the same regardless of differences in byte size | |
195 | between the two machines (in theory \- in practice you should only use | |
196 | this if you really know what you're doing). | |
197 | .SH "CONSTRUCTOR" | |
198 | .IX Header "CONSTRUCTOR" | |
199 | .IP "new ([ \s-1HOST\s0 ] [, \s-1OPTIONS\s0 ])" 4 | |
200 | .IX Item "new ([ HOST ] [, OPTIONS ])" | |
201 | This is the constructor for a new Net::FTP object. \f(CW\*(C`HOST\*(C'\fR is the | |
202 | name of the remote host to which an \s-1FTP\s0 connection is required. | |
203 | .Sp | |
204 | \&\f(CW\*(C`HOST\*(C'\fR is optional. If \f(CW\*(C`HOST\*(C'\fR is not given then it may instead be | |
205 | passed as the \f(CW\*(C`Host\*(C'\fR option described below. | |
206 | .Sp | |
207 | \&\f(CW\*(C`OPTIONS\*(C'\fR are passed in a hash like fashion, using key and value pairs. | |
208 | Possible options are: | |
209 | .Sp | |
210 | \&\fBHost\fR \- \s-1FTP\s0 host to connect to. It may be a single scalar, as defined for | |
211 | the \f(CW\*(C`PeerAddr\*(C'\fR option in IO::Socket::INET, or a reference to | |
212 | an array with hosts to try in turn. The \*(L"host\*(R" method will return the value | |
213 | which was used to connect to the host. | |
214 | .Sp | |
215 | \&\fBFirewall\fR \- The name of a machine which acts as an \s-1FTP\s0 firewall. This can be | |
216 | overridden by an environment variable \f(CW\*(C`FTP_FIREWALL\*(C'\fR. If specified, and the | |
217 | given host cannot be directly connected to, then the | |
218 | connection is made to the firewall machine and the string \f(CW@hostname\fR is | |
219 | appended to the login identifier. This kind of setup is also refered to | |
220 | as an ftp proxy. | |
221 | .Sp | |
222 | \&\fBFirewallType\fR \- The type of firewall running on the machine indicated by | |
223 | \&\fBFirewall\fR. This can be overridden by an environment variable | |
224 | \&\f(CW\*(C`FTP_FIREWALL_TYPE\*(C'\fR. For a list of permissible types, see the description of | |
225 | ftp_firewall_type in Net::Config. | |
226 | .Sp | |
227 | \&\fBBlockSize\fR \- This is the block size that Net::FTP will use when doing | |
228 | transfers. (defaults to 10240) | |
229 | .Sp | |
230 | \&\fBPort\fR \- The port number to connect to on the remote machine for the | |
231 | \&\s-1FTP\s0 connection | |
232 | .Sp | |
233 | \&\fBTimeout\fR \- Set a timeout value (defaults to 120) | |
234 | .Sp | |
235 | \&\fBDebug\fR \- debug level (see the debug method in Net::Cmd) | |
236 | .Sp | |
237 | \&\fBPassive\fR \- If set to a non-zero value then all data transfers will be done | |
238 | using passive mode. This is not usually required except for some \fIdumb\fR | |
239 | servers, and some firewall configurations. This can also be set by the | |
240 | environment variable \f(CW\*(C`FTP_PASSIVE\*(C'\fR. | |
241 | .Sp | |
242 | \&\fBHash\fR \- If given a reference to a file handle (e.g., \f(CW\*(C`\e*STDERR\*(C'\fR), | |
243 | print hash marks (#) on that filehandle every 1024 bytes. This | |
244 | simply invokes the \f(CW\*(C`hash()\*(C'\fR method for you, so that hash marks | |
245 | are displayed for all transfers. You can, of course, call \f(CW\*(C`hash()\*(C'\fR | |
246 | explicitly whenever you'd like. | |
247 | .Sp | |
248 | \&\fBLocalAddr\fR \- Local address to use for all socket connections, this | |
249 | argument will be passed to IO::Socket::INET | |
250 | .Sp | |
251 | If the constructor fails undef will be returned and an error message will | |
252 | be in $@ | |
253 | .SH "METHODS" | |
254 | .IX Header "METHODS" | |
255 | Unless otherwise stated all methods return either a \fItrue\fR or \fIfalse\fR | |
256 | value, with \fItrue\fR meaning that the operation was a success. When a method | |
257 | states that it returns a value, failure will be returned as \fIundef\fR or an | |
258 | empty list. | |
259 | .IP "login ([\s-1LOGIN\s0 [,PASSWORD [, \s-1ACCOUNT\s0] ] ])" 4 | |
260 | .IX Item "login ([LOGIN [,PASSWORD [, ACCOUNT] ] ])" | |
261 | Log into the remote \s-1FTP\s0 server with the given login information. If | |
262 | no arguments are given then the \f(CW\*(C`Net::FTP\*(C'\fR uses the \f(CW\*(C`Net::Netrc\*(C'\fR | |
263 | package to lookup the login information for the connected host. | |
264 | If no information is found then a login of \fIanonymous\fR is used. | |
265 | If no password is given and the login is \fIanonymous\fR then \fIanonymous@\fR | |
266 | will be used for password. | |
267 | .Sp | |
268 | If the connection is via a firewall then the \f(CW\*(C`authorize\*(C'\fR method will | |
269 | be called with no arguments. | |
270 | .IP "authorize ( [\s-1AUTH\s0 [, \s-1RESP\s0]])" 4 | |
271 | .IX Item "authorize ( [AUTH [, RESP]])" | |
272 | This is a protocol used by some firewall ftp proxies. It is used | |
273 | to authorise the user to send data out. If both arguments are not specified | |
274 | then \f(CW\*(C`authorize\*(C'\fR uses \f(CW\*(C`Net::Netrc\*(C'\fR to do a lookup. | |
275 | .IP "site (\s-1ARGS\s0)" 4 | |
276 | .IX Item "site (ARGS)" | |
277 | Send a \s-1SITE\s0 command to the remote server and wait for a response. | |
278 | .Sp | |
279 | Returns most significant digit of the response code. | |
280 | .IP "ascii" 4 | |
281 | .IX Item "ascii" | |
282 | Transfer file in \s-1ASCII\s0. \s-1CRLF\s0 translation will be done if required | |
283 | .IP "binary" 4 | |
284 | .IX Item "binary" | |
285 | Transfer file in binary mode. No transformation will be done. | |
286 | .Sp | |
287 | \&\fBHint\fR: If both server and client machines use the same line ending for | |
288 | text files, then it will be faster to transfer all files in binary mode. | |
289 | .IP "rename ( \s-1OLDNAME\s0, \s-1NEWNAME\s0 )" 4 | |
290 | .IX Item "rename ( OLDNAME, NEWNAME )" | |
291 | 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 | |
292 | is done by sending the \s-1RNFR\s0 and \s-1RNTO\s0 commands. | |
293 | .IP "delete ( \s-1FILENAME\s0 )" 4 | |
294 | .IX Item "delete ( FILENAME )" | |
295 | Send a request to the server to delete \f(CW\*(C`FILENAME\*(C'\fR. | |
296 | .IP "cwd ( [ \s-1DIR\s0 ] )" 4 | |
297 | .IX Item "cwd ( [ DIR ] )" | |
298 | Attempt to change directory to the directory given in \f(CW$dir\fR. If | |
299 | \&\f(CW$dir\fR is \f(CW".."\fR, the \s-1FTP\s0 \f(CW\*(C`CDUP\*(C'\fR command is used to attempt to | |
300 | move up one directory. If no directory is given then an attempt is made | |
301 | to change the directory to the root directory. | |
302 | .IP "cdup ()" 4 | |
303 | .IX Item "cdup ()" | |
304 | Change directory to the parent of the current directory. | |
305 | .IP "pwd ()" 4 | |
306 | .IX Item "pwd ()" | |
307 | Returns the full pathname of the current directory. | |
308 | .IP "restart ( \s-1WHERE\s0 )" 4 | |
309 | .IX Item "restart ( WHERE )" | |
310 | Set the byte offset at which to begin the next data transfer. Net::FTP simply | |
311 | records this value and uses it when during the next data transfer. For this | |
312 | reason this method will not return an error, but setting it may cause | |
313 | a subsequent data transfer to fail. | |
314 | .IP "rmdir ( \s-1DIR\s0 [, \s-1RECURSE\s0 ])" 4 | |
315 | .IX Item "rmdir ( DIR [, RECURSE ])" | |
316 | Remove the directory with the name \f(CW\*(C`DIR\*(C'\fR. If \f(CW\*(C`RECURSE\*(C'\fR is \fItrue\fR then | |
317 | \&\f(CW\*(C`rmdir\*(C'\fR will attempt to delete everything inside the directory. | |
318 | .IP "mkdir ( \s-1DIR\s0 [, \s-1RECURSE\s0 ])" 4 | |
319 | .IX Item "mkdir ( DIR [, RECURSE ])" | |
320 | Create a new directory with the name \f(CW\*(C`DIR\*(C'\fR. If \f(CW\*(C`RECURSE\*(C'\fR is \fItrue\fR then | |
321 | \&\f(CW\*(C`mkdir\*(C'\fR will attempt to create all the directories in the given path. | |
322 | .Sp | |
323 | Returns the full pathname to the new directory. | |
324 | .IP "alloc ( \s-1SIZE\s0 [, \s-1RECORD_SIZE\s0] )" 4 | |
325 | .IX Item "alloc ( SIZE [, RECORD_SIZE] )" | |
326 | The alloc command allows you to give the ftp server a hint about the size | |
327 | of the file about to be transfered using the \s-1ALLO\s0 ftp command. Some storage | |
328 | systems use this to make intelligent decisions about how to store the file. | |
329 | The \f(CW\*(C`SIZE\*(C'\fR argument represents the size of the file in bytes. The | |
330 | \&\f(CW\*(C`RECORD_SIZE\*(C'\fR argument indicates a mazimum record or page size for files | |
331 | sent with a record or page structure. | |
332 | .Sp | |
333 | The size of the file will be determined, and sent to the server | |
334 | automatically for normal files so that this method need only be called if | |
335 | you are transfering data from a socket, named pipe, or other stream not | |
336 | associated with a normal file. | |
337 | .IP "ls ( [ \s-1DIR\s0 ] )" 4 | |
338 | .IX Item "ls ( [ DIR ] )" | |
339 | Get a directory listing of \f(CW\*(C`DIR\*(C'\fR, or the current directory. | |
340 | .Sp | |
341 | In an array context, returns a list of lines returned from the server. In | |
342 | a scalar context, returns a reference to a list. | |
343 | .IP "dir ( [ \s-1DIR\s0 ] )" 4 | |
344 | .IX Item "dir ( [ DIR ] )" | |
345 | Get a directory listing of \f(CW\*(C`DIR\*(C'\fR, or the current directory in long format. | |
346 | .Sp | |
347 | In an array context, returns a list of lines returned from the server. In | |
348 | a scalar context, returns a reference to a list. | |
349 | .IP "get ( \s-1REMOTE_FILE\s0 [, \s-1LOCAL_FILE\s0 [, \s-1WHERE\s0]] )" 4 | |
350 | .IX Item "get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] )" | |
351 | Get \f(CW\*(C`REMOTE_FILE\*(C'\fR from the server and store locally. \f(CW\*(C`LOCAL_FILE\*(C'\fR may be | |
352 | a filename or a filehandle. If not specified, the file will be stored in | |
353 | the current directory with the same leafname as the remote file. | |
354 | .Sp | |
355 | If \f(CW\*(C`WHERE\*(C'\fR is given then the first \f(CW\*(C`WHERE\*(C'\fR bytes of the file will | |
356 | not be transfered, and the remaining bytes will be appended to | |
357 | the local file if it already exists. | |
358 | .Sp | |
359 | Returns \f(CW\*(C`LOCAL_FILE\*(C'\fR, or the generated local file name if \f(CW\*(C`LOCAL_FILE\*(C'\fR | |
360 | is not given. If an error was encountered undef is returned. | |
361 | .IP "put ( \s-1LOCAL_FILE\s0 [, \s-1REMOTE_FILE\s0 ] )" 4 | |
362 | .IX Item "put ( LOCAL_FILE [, REMOTE_FILE ] )" | |
363 | Put a file on the remote server. \f(CW\*(C`LOCAL_FILE\*(C'\fR may be a name or a filehandle. | |
364 | If \f(CW\*(C`LOCAL_FILE\*(C'\fR is a filehandle then \f(CW\*(C`REMOTE_FILE\*(C'\fR must be specified. If | |
365 | \&\f(CW\*(C`REMOTE_FILE\*(C'\fR is not specified then the file will be stored in the current | |
366 | directory with the same leafname as \f(CW\*(C`LOCAL_FILE\*(C'\fR. | |
367 | .Sp | |
368 | Returns \f(CW\*(C`REMOTE_FILE\*(C'\fR, or the generated remote filename if \f(CW\*(C`REMOTE_FILE\*(C'\fR | |
369 | is not given. | |
370 | .Sp | |
371 | \&\fB\s-1NOTE\s0\fR: If for some reason the transfer does not complete and an error is | |
372 | returned then the contents that had been transfered will not be remove | |
373 | automatically. | |
374 | .IP "put_unique ( \s-1LOCAL_FILE\s0 [, \s-1REMOTE_FILE\s0 ] )" 4 | |
375 | .IX Item "put_unique ( LOCAL_FILE [, REMOTE_FILE ] )" | |
376 | Same as put but uses the \f(CW\*(C`STOU\*(C'\fR command. | |
377 | .Sp | |
378 | Returns the name of the file on the server. | |
379 | .IP "append ( \s-1LOCAL_FILE\s0 [, \s-1REMOTE_FILE\s0 ] )" 4 | |
380 | .IX Item "append ( LOCAL_FILE [, REMOTE_FILE ] )" | |
381 | Same as put but appends to the file on the remote server. | |
382 | .Sp | |
383 | Returns \f(CW\*(C`REMOTE_FILE\*(C'\fR, or the generated remote filename if \f(CW\*(C`REMOTE_FILE\*(C'\fR | |
384 | is not given. | |
385 | .IP "unique_name ()" 4 | |
386 | .IX Item "unique_name ()" | |
387 | Returns the name of the last file stored on the server using the | |
388 | \&\f(CW\*(C`STOU\*(C'\fR command. | |
389 | .IP "mdtm ( \s-1FILE\s0 )" 4 | |
390 | .IX Item "mdtm ( FILE )" | |
391 | Returns the \fImodification time\fR of the given file | |
392 | .IP "size ( \s-1FILE\s0 )" 4 | |
393 | .IX Item "size ( FILE )" | |
394 | Returns the size in bytes for the given file as stored on the remote server. | |
395 | .Sp | |
396 | \&\fB\s-1NOTE\s0\fR: The size reported is the size of the stored file on the remote server. | |
397 | If the file is subsequently transfered from the server in \s-1ASCII\s0 mode | |
398 | and the remote server and local machine have different ideas about | |
399 | \&\*(L"End Of Line\*(R" then the size of file on the local machine after transfer | |
400 | may be different. | |
401 | .IP "supported ( \s-1CMD\s0 )" 4 | |
402 | .IX Item "supported ( CMD )" | |
403 | Returns \s-1TRUE\s0 if the remote server supports the given command. | |
404 | .IP "hash ( [\s-1FILEHANDLE_GLOB_REF\s0],[ \s-1BYTES_PER_HASH_MARK\s0] )" 4 | |
405 | .IX Item "hash ( [FILEHANDLE_GLOB_REF],[ BYTES_PER_HASH_MARK] )" | |
406 | Called without parameters, or with the first argument false, hash marks | |
407 | are suppressed. If the first argument is true but not a reference to a | |
408 | file handle glob, then \e*STDERR is used. The second argument is the number | |
409 | of bytes per hash mark printed, and defaults to 1024. In all cases the | |
410 | return value is a reference to an array of two: the filehandle glob reference | |
411 | and the bytes per hash mark. | |
412 | .PP | |
413 | The following methods can return different results depending on | |
414 | how they are called. If the user explicitly calls either | |
415 | of the \f(CW\*(C`pasv\*(C'\fR or \f(CW\*(C`port\*(C'\fR methods then these methods will | |
416 | return a \fItrue\fR or \fIfalse\fR value. If the user does not | |
417 | call either of these methods then the result will be a | |
418 | reference to a \f(CW\*(C`Net::FTP::dataconn\*(C'\fR based object. | |
419 | .IP "nlst ( [ \s-1DIR\s0 ] )" 4 | |
420 | .IX Item "nlst ( [ DIR ] )" | |
421 | Send an \f(CW\*(C`NLST\*(C'\fR command to the server, with an optional parameter. | |
422 | .IP "list ( [ \s-1DIR\s0 ] )" 4 | |
423 | .IX Item "list ( [ DIR ] )" | |
424 | Same as \f(CW\*(C`nlst\*(C'\fR but using the \f(CW\*(C`LIST\*(C'\fR command | |
425 | .IP "retr ( \s-1FILE\s0 )" 4 | |
426 | .IX Item "retr ( FILE )" | |
427 | Begin the retrieval of a file called \f(CW\*(C`FILE\*(C'\fR from the remote server. | |
428 | .IP "stor ( \s-1FILE\s0 )" 4 | |
429 | .IX Item "stor ( FILE )" | |
430 | Tell the server that you wish to store a file. \f(CW\*(C`FILE\*(C'\fR is the | |
431 | name of the new file that should be created. | |
432 | .IP "stou ( \s-1FILE\s0 )" 4 | |
433 | .IX Item "stou ( FILE )" | |
434 | Same as \f(CW\*(C`stor\*(C'\fR but using the \f(CW\*(C`STOU\*(C'\fR command. The name of the unique | |
435 | file which was created on the server will be available via the \f(CW\*(C`unique_name\*(C'\fR | |
436 | method after the data connection has been closed. | |
437 | .IP "appe ( \s-1FILE\s0 )" 4 | |
438 | .IX Item "appe ( FILE )" | |
439 | Tell the server that we want to append some data to the end of a file | |
440 | called \f(CW\*(C`FILE\*(C'\fR. If this file does not exist then create it. | |
441 | .PP | |
442 | If for some reason you want to have complete control over the data connection, | |
443 | this includes generating it and calling the \f(CW\*(C`response\*(C'\fR method when required, | |
444 | then the user can use these methods to do so. | |
445 | .PP | |
446 | However calling these methods only affects the use of the methods above that | |
447 | can return a data connection. They have no effect on methods \f(CW\*(C`get\*(C'\fR, \f(CW\*(C`put\*(C'\fR, | |
448 | \&\f(CW\*(C`put_unique\*(C'\fR and those that do not require data connections. | |
449 | .IP "port ( [ \s-1PORT\s0 ] )" 4 | |
450 | .IX Item "port ( [ PORT ] )" | |
451 | 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 | |
452 | to the server. If not, then a listen socket is created and the correct information | |
453 | sent to the server. | |
454 | .IP "pasv ()" 4 | |
455 | .IX Item "pasv ()" | |
456 | Tell the server to go into passive mode. Returns the text that represents the | |
457 | port on which the server is listening, this text is in a suitable form to | |
458 | sent to another ftp server using the \f(CW\*(C`port\*(C'\fR method. | |
459 | .PP | |
460 | The following methods can be used to transfer files between two remote | |
461 | servers, providing that these two servers can connect directly to each other. | |
462 | .IP "pasv_xfer ( \s-1SRC_FILE\s0, \s-1DEST_SERVER\s0 [, \s-1DEST_FILE\s0 ] )" 4 | |
463 | .IX Item "pasv_xfer ( SRC_FILE, DEST_SERVER [, DEST_FILE ] )" | |
464 | This method will do a file transfer between two remote ftp servers. If | |
465 | \&\f(CW\*(C`DEST_FILE\*(C'\fR is omitted then the leaf name of \f(CW\*(C`SRC_FILE\*(C'\fR will be used. | |
466 | .IP "pasv_xfer_unique ( \s-1SRC_FILE\s0, \s-1DEST_SERVER\s0 [, \s-1DEST_FILE\s0 ] )" 4 | |
467 | .IX Item "pasv_xfer_unique ( SRC_FILE, DEST_SERVER [, DEST_FILE ] )" | |
468 | Like \f(CW\*(C`pasv_xfer\*(C'\fR but the file is stored on the remote server using | |
469 | the \s-1STOU\s0 command. | |
470 | .IP "pasv_wait ( \s-1NON_PASV_SERVER\s0 )" 4 | |
471 | .IX Item "pasv_wait ( NON_PASV_SERVER )" | |
472 | This method can be used to wait for a transfer to complete between a passive | |
473 | server and a non-passive server. The method should be called on the passive | |
474 | server with the \f(CW\*(C`Net::FTP\*(C'\fR object for the non-passive server passed as an | |
475 | argument. | |
476 | .IP "abort ()" 4 | |
477 | .IX Item "abort ()" | |
478 | Abort the current data transfer. | |
479 | .IP "quit ()" 4 | |
480 | .IX Item "quit ()" | |
481 | Send the \s-1QUIT\s0 command to the remote \s-1FTP\s0 server and close the socket connection. | |
482 | .Sh "Methods for the adventurous" | |
483 | .IX Subsection "Methods for the adventurous" | |
484 | \&\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 | |
485 | be used to send commands to the remote \s-1FTP\s0 server. | |
486 | .IP "quot (\s-1CMD\s0 [,ARGS])" 4 | |
487 | .IX Item "quot (CMD [,ARGS])" | |
488 | Send a command, that Net::FTP does not directly support, to the remote | |
489 | server and wait for a response. | |
490 | .Sp | |
491 | Returns most significant digit of the response code. | |
492 | .Sp | |
493 | \&\fB\s-1WARNING\s0\fR This call should only be used on commands that do not require | |
494 | data connections. Misuse of this method can hang the connection. | |
495 | .SH "THE dataconn CLASS" | |
496 | .IX Header "THE dataconn CLASS" | |
497 | Some of the methods defined in \f(CW\*(C`Net::FTP\*(C'\fR return an object which will | |
498 | be derived from this class.The dataconn class itself is derived from | |
499 | the \f(CW\*(C`IO::Socket::INET\*(C'\fR class, so any normal \s-1IO\s0 operations can be performed. | |
500 | However the following methods are defined in the dataconn class and \s-1IO\s0 should | |
501 | be performed using these. | |
502 | .IP "read ( \s-1BUFFER\s0, \s-1SIZE\s0 [, \s-1TIMEOUT\s0 ] )" 4 | |
503 | .IX Item "read ( BUFFER, SIZE [, TIMEOUT ] )" | |
504 | Read \f(CW\*(C`SIZE\*(C'\fR bytes of data from the server and place it into \f(CW\*(C`BUFFER\*(C'\fR, also | |
505 | performing any <\s-1CRLF\s0> translation necessary. \f(CW\*(C`TIMEOUT\*(C'\fR is optional, if not | |
506 | given, the timeout value from the command connection will be used. | |
507 | .Sp | |
508 | Returns the number of bytes read before any <\s-1CRLF\s0> translation. | |
509 | .IP "write ( \s-1BUFFER\s0, \s-1SIZE\s0 [, \s-1TIMEOUT\s0 ] )" 4 | |
510 | .IX Item "write ( BUFFER, SIZE [, TIMEOUT ] )" | |
511 | Write \f(CW\*(C`SIZE\*(C'\fR bytes of data from \f(CW\*(C`BUFFER\*(C'\fR to the server, also | |
512 | performing any <\s-1CRLF\s0> translation necessary. \f(CW\*(C`TIMEOUT\*(C'\fR is optional, if not | |
513 | given, the timeout value from the command connection will be used. | |
514 | .Sp | |
515 | Returns the number of bytes written before any <\s-1CRLF\s0> translation. | |
516 | .IP "bytes_read ()" 4 | |
517 | .IX Item "bytes_read ()" | |
518 | Returns the number of bytes read so far. | |
519 | .IP "abort ()" 4 | |
520 | .IX Item "abort ()" | |
521 | Abort the current data transfer. | |
522 | .IP "close ()" 4 | |
523 | .IX Item "close ()" | |
524 | Close the data connection and get a response from the \s-1FTP\s0 server. Returns | |
525 | \&\fItrue\fR if the connection was closed successfully and the first digit of | |
526 | the response from the server was a '2'. | |
527 | .SH "UNIMPLEMENTED" | |
528 | .IX Header "UNIMPLEMENTED" | |
529 | The following \s-1RFC959\s0 commands have not been implemented: | |
530 | .IP "\fB\s-1SMNT\s0\fR" 4 | |
531 | .IX Item "SMNT" | |
532 | Mount a different file system structure without changing login or | |
533 | accounting information. | |
534 | .IP "\fB\s-1HELP\s0\fR" 4 | |
535 | .IX Item "HELP" | |
536 | Ask the server for \*(L"helpful information\*(R" (that's what the \s-1RFC\s0 says) on | |
537 | the commands it accepts. | |
538 | .IP "\fB\s-1MODE\s0\fR" 4 | |
539 | .IX Item "MODE" | |
540 | Specifies transfer mode (stream, block or compressed) for file to be | |
541 | transferred. | |
542 | .IP "\fB\s-1SYST\s0\fR" 4 | |
543 | .IX Item "SYST" | |
544 | Request remote server system identification. | |
545 | .IP "\fB\s-1STAT\s0\fR" 4 | |
546 | .IX Item "STAT" | |
547 | Request remote server status. | |
548 | .IP "\fB\s-1STRU\s0\fR" 4 | |
549 | .IX Item "STRU" | |
550 | Specifies file structure for file to be transferred. | |
551 | .IP "\fB\s-1REIN\s0\fR" 4 | |
552 | .IX Item "REIN" | |
553 | Reinitialize the connection, flushing all I/O and account information. | |
554 | .SH "REPORTING BUGS" | |
555 | .IX Header "REPORTING BUGS" | |
556 | When reporting bugs/problems please include as much information as possible. | |
557 | It may be difficult for me to reproduce the problem as almost every setup | |
558 | is different. | |
559 | .PP | |
560 | A small script which yields the problem will probably be of help. It would | |
561 | also be useful if this script was run with the extra options \f(CW\*(C`Debug =\*(C'\fR 1> | |
562 | passed to the constructor, and the output sent with the bug report. If you | |
563 | cannot include a small script then please include a Debug trace from a | |
564 | run of your program which does yield the problem. | |
565 | .SH "AUTHOR" | |
566 | .IX Header "AUTHOR" | |
567 | Graham Barr <gbarr@pobox.com> | |
568 | .SH "SEE ALSO" | |
569 | .IX Header "SEE ALSO" | |
570 | Net::Netrc | |
571 | Net::Cmd | |
572 | .PP | |
573 | \&\fIftp\fR\|(1), \fIftpd\fR\|(8), \s-1RFC\s0 959 | |
574 | http://www.cis.ohio\-state.edu/htbin/rfc/rfc959.html | |
575 | .SH "USE EXAMPLES" | |
576 | .IX Header "USE EXAMPLES" | |
577 | For an example of the use of Net::FTP see | |
578 | .IP "http://www.csh.rit.edu/~adam/Progs/" 4 | |
579 | .IX Item "http://www.csh.rit.edu/~adam/Progs/" | |
580 | \&\f(CW\*(C`autoftp\*(C'\fR is a program that can retrieve, send, or list files via | |
581 | the \s-1FTP\s0 protocol in a non-interactive manner. | |
582 | .SH "CREDITS" | |
583 | .IX Header "CREDITS" | |
584 | Henry Gabryjelski <henryg@WPI.EDU> \- for the suggestion of creating directories | |
585 | recursively. | |
586 | .PP | |
587 | Nathan Torkington <gnat@frii.com> \- for some input on the documentation. | |
588 | .PP | |
589 | Roderick Schertler <roderick@gate.net> \- for various inputs | |
590 | .SH "COPYRIGHT" | |
591 | .IX Header "COPYRIGHT" | |
592 | Copyright (c) 1995\-2004 Graham Barr. All rights reserved. | |
593 | This program is free software; you can redistribute it and/or modify it | |
594 | under the same terms as Perl itself. |