Re: PUTting using FTP
Eric Lease Morgan (eric_morgan@ncsu.edu)
Wed, 04 Jun 1997 11:16:42 -0400
Gisle Aas wrote:
> > Using the LWP library, I would like to PUT a file on a remote machine
> > via FTP. The script below correctly creates a file on the remote
> > machine, but the file is 0 bytes long. I believe the syntax I am using
> > to PUT the file is incomplete:
>
> You need to fill the file with some content if you want it to be more
> than 0 bytes long.
>
> > # create the requeset ($r)
> > # does the following command need to know the local file name?
> > $r = new HTTP::Request 'PUT', "$u";
>
> $r->content(scalar `cat test.txt`); # for instance
Thank you for the prompt reply. This makes sense.
BTW, I found another library (libnet found on CPAN) that implements a
more functional FTP interface. If you are only doing FTP, then libnet
may be the way to go. If you are doing more general file retrieval
and/or file analysis, then LWP is a better choice.
It just goes to show you that old the Perl adage is correct. "There is
more than one way to do things."
--
Eric Lease Morgan
NCSU Libraries
http://www.lib.ncsu.edu/staff/morgan/