http://qs1969.pair.com?node_id=574343


in reply to NET::FTP: ls command fails

esskar,

use Net::FTP; my $ftp = Net::FTP->new( "192.168.10.240", Debug => 1) or die "Cannot connect to " . "192.168.10.240" . ": $@"; $ftp->login("metrica", "metrica") or die "Cannot login ", $ftp->message; $ftp->cwd("/apps/inst1/metrica") or die "Cannot change working directory ", $ftp->message; $ftp->pasv; my @dir = $ftp->ls; # <-- LINE 50 print "Files :" , join('-',@dir), "\n";
I executed the above code and it worked fine for me.
Trace output
C:\Perl>perl l.pl Net::FTP>>> Net::FTP(2.75) Net::FTP>>> Exporter(5.58) Net::FTP>>> Net::Cmd(2.26) Net::FTP>>> IO::Socket::INET(1.29) Net::FTP>>> IO::Socket(1.29) Net::FTP>>> IO::Handle(1.25) Net::FTP=GLOB(0x18331d8)<<< 220 osmosis FTP server ready. Net::FTP=GLOB(0x18331d8)>>> user metrica Net::FTP=GLOB(0x18331d8)<<< 331 Password required for metrica. Net::FTP=GLOB(0x18331d8)>>> PASS .... Net::FTP=GLOB(0x18331d8)<<< 230 User metrica logged in. Net::FTP=GLOB(0x18331d8)>>> CWD /apps/inst1/metrica Net::FTP=GLOB(0x18331d8)<<< 250 CWD command successful. Net::FTP=GLOB(0x18331d8)>>> PASV Net::FTP=GLOB(0x18331d8)<<< 227 Entering Passive Mode (192,168,10,240, +227,44) Net::FTP=GLOB(0x18331d8)>>> PASV Net::FTP=GLOB(0x18331d8)<<< 227 Entering Passive Mode (192,168,10,240, +227,44) Net::FTP=GLOB(0x18331d8)>>> NLST Net::FTP=GLOB(0x18331d8)<<< 150 Opening ASCII mode data connection for + file list . Net::FTP=GLOB(0x18331d8)<<< 226 Transfer complete. Files :AlarmManagement-CS-DBElements-DBLoader-DBServices-DataSources-E +xtenders-E xternal-GroupingService-Installer-MLEditor-MetaLayer-PMhelp-ReportDesi +gner-Repor ting-SPRegistry-Security-StartStop-SystemManagement-SystemTPhelp-Techn +ologyPacks -Uiweb-antony.txt-cell-tch-REPRT_0610-export-config-file.xml-cell-tch- +argan-expo rt-config-file.xml-cell-tch-rflosses-export-config-file.xml-cell_voice +_traffic_r aw_spr-param.xml-etc-ext-install_setup.ksh-logs-maeve-metrica_healthch +eck.html-n ohup.out-one.pl-setup.ksh-setup.tpl-setup_appserver.ksh-setup_informix +.ksh-setup _java.ksh-setup_openfusion.ksh-update3FFPromo.pl-utils

"Keep pouring your ideas"

Replies are listed 'Best First'.
Re^2: NET::FTP: ls command fails
by esskar (Deacon) on Sep 22, 2006 at 08:50 UTC
    yes; i think it may be a problem with the MS Ftp Server. But i do no know.

    and there is actually a difference. In your case, no PORT command is send to server; so it is working. But somehow, in my case it is sending a PORT command; maybe i should try to call NLST directly