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"
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.