Mike Blackwell > IO-Ftp > IO::Ftp

Download:
IO-Ftp-0.05.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.05   Source  

NAME ^

IO::Ftp - A simple interface to Net::FTP's socket level get/put

SYNOPSIS ^

 use IO::Ftp;
 
 my $out = IO::Ftp->new('>','//user:pwd@foo.bar.com/foo/bar/fu.bar', TYPE=>'a');
 my $in = IO::Ftp->new('<','//foo.bar.com/foo/bar/fu.bar', TYPE=>'a');  #anon access example
  
 while (<$in>) {
        s/foo/bar/g;
        print $out;
 }
 
 close $in;
 close $out;

### for something along the lines of 'mget':

while (my $in = IO::Ftp->new('<<','//foo.bar.com/foo/bar/*.txt', TYPE=>'a') { print "processing ",$in->filename, "\n"; #... $in->close; $in->delete; }

DESCRIPTION ^

EXPORTS

None by default.

REQUIRES

Net::FTP File::Basename URI Symbol

CONSTRUCTOR ^

new ( MODE, URI [,OPTIONS] )

MODE indicates the FTP command to use, and is one of

< get
> put
>> append
<< get with wildcard match. This allows fetching a file when the name is not known, or is partially known. Wildcarding is as performed by Net::FTP::ls. If more than one file matches, the same one will always be returned. To process a number of files, they must be deleted or renamed to not match the wildcard.

URI is an FTP format URI without the leading 'ftp:'. OPTIONS are passed in hash format, and can be one or more of

TYPE force ASCII (a) or binary (i) mode for the transfer.
DEBUG Enables debug messages. Also enabled Net::FTP's Debug flag.
Timeout Passed to Net::FTP::new
BlockSize Passed to Net::FTP::new
Passive Passed to Net::FTP::new

METHODS ^

rename_to (NEW_NAME) Renames the file.
delete Deletes the file.
size Returns the size of the file.
mdtm Returns the modification time of the fiile.

size and mdtm cache their values before the socket is opened. After the socket is closed, they call the Net::FTP methods of the same name.

CREDITS ^

Graham Barr for his Net::FTP module, which does all the 'real work'.

tye at PerlMonks

COPYRIGHT ^

(c) 2003 Mike Blackwell. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR ^

Mike Blackwell <mikeb@cpan.org>

SEE ALSO ^

Net::FTP perl(1).