At 11:19 PM +0100 10/19/01, Graham Barr wrote: >On Fri, Oct 19, 2001 at 03:06:27PM -0700, Terrence Monroe Brannon wrote: >> Actually, in my case, I believe I need retr and using >> $ftp->retr($file) works while $retr->cmd('retr',$file) > >Well get is another layer on top of retr. retr will return a file handle >you can read from, get will read from that handle and save it locally
Right and for our purposes , RETR is more appropriate. And since I have your attention, I may as well mention something. We are using Net::FTPServer to create a FTP interface to our backend FTP repositories, which we access via Net::FTP. So the idea is when a GET is issued on the front end Net::FTPServer, does a RETR on our backend servers and then handles the transfer of the file from our remote backend to the client frontend. However, one problem we were having was with resuming downloads via REST, and this is because Net::FTP::I doesnt have a seek function and so I emulated by repeatedly reading until I reached the desired byte position. The problem with Net::FTP::I::sysread (from my perspective) is that it tries to read as many bytes off a socket as it can instead of reading the requested amount. This was causing problems for me when seeking to a position in a file by issuing repeated $net_ftp_i->sysread calls. So I uploaded to CPAN Net::FTP::I::sysseek which allows me to seek to a position in a RETR'ed filehandle by using repeated reads. Using REST on the backend was not an option because the Solaris FTP server supports it and corporate restraints prevent changing it. >Graham. > >> >> does not. >> >> and the error goes away when I use retr directly. >> >> >Thats because you should be using ->get not ->cmd. The retr command needs >> >to be used with other commands, like port or pasv, which ->get will do >> >for you >> > >> >Graham. >> > >> >On Thu, Oct 18, 2001 at 04:17:24PM -0700, Terrence Monroe Brannon wrote: >> >> I get an error when attempting to do a RETR with my Net::FTP script. >> >> source code and Debug log below... thanks for any help >> >> >> >> use lib '/m/aru/aruforms/pm'; >> >> use Net::FTP; >> >> use strict; >> >> >> >> my $host = 'ap555sun.us.oracle.com'; >> >> my $file = >>'/d1/prepos/dev/apfrepos/NLS/rel11i/twncan/p1774034_11i_zht.zip'; >> >> >> >> >> >> my $n = Net::FTP->new($host, Debug => 1, Passive => 1); >> >> # $n->login('tmbranno','xxx'); >> >> # $n->login('anonymous', 'tmbranno@ap555sun'); >> >> $n->login; # use .netrc >> >> >> >> my $o = $n->cmd('retr', $file); >> >> >> >> >> >> >> >> Net::FTP=GLOB(0x2b51e4)<<< 220 ap555sun.us.oracle.com FTP server >> >> (Version wu-2.\ >> >> 6.1(1) Thu Apr 26 13:07:30 PDT 2001) ready. >> >> Net::FTP=GLOB(0x2b51e4)>>> user tmbranno^M >> >> Net::FTP=GLOB(0x2b51e4)<<< 331 Password required for tmbranno. >> >> Net::FTP=GLOB(0x2b51e4)>>> PASS .... >> >> Net::FTP=GLOB(0x2b51e4)<<< 230 User tmbranno logged in. >> >> Net::FTP=GLOB(0x2b51e4)>>> retr >> >> /d1/prepos/dev/apfrepos/NLS/rel11i/twncan/p1774\ >> >> 034_11i_zht.zip^M >> >> Net::FTP=GLOB(0x2b51e4)<<< 425 Can't build data connection: >> >>Connection refused. >> >> ::for 83 at f1.pl line 18. >> >> Net::FTP=GLOB(0x2b51e4)>>> QUIT^M >> >> Net::FTP=GLOB(0x2b51e4)<<< 221-You have transferred 0 bytes in 0 files. >> >> ^M >> >> {ap555sun:tmbranno:tmbranno_1693779_arulinkftp:arudev}16> >> >> /home/tmbranno/bugsag\ >> >> a ^M/2058255^[[71C ^M% >> >> >> >> >> >> -- >> >> >> -- --