473,473 Members | 2,277 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

FTP Client

23 New Member
I 'm creating a FTP client and i get an error when i try this

Can't locate object method "ls" via package "ftp" (perhaps you forgot to load "f
tp"?) at ftp.pl line 239, <> line 1.



The below is the subroutine, i get input from the user and put the same to an arry and take that again for later usage,

Expand|Select|Wrap|Line Numbers
  1. $ftp = Net::FTP->new($site, Debug => 0)
  2. $ftp->login($un,$pwd);
  3.  
  4. $free = @comm[1];
  5. @list = $ftp->ls($free); # I get the error here !
  6. foreach (@list){
  7. print "\n".$_."\n";
  8. }
  9. prwrkdir();
  10. comm();
  11.  
Jan 9 '08 #1
3 1628
numberwhun
3,509 Recognized Expert Moderator Specialist
I 'm creating a FTP client and i get an error when i try this

Can't locate object method "ls" via package "ftp" (perhaps you forgot to load "f
tp"?) at ftp.pl line 239, <> line 1.



The below is the subroutine, i get input from the user and put the same to an arry and take that again for later usage,

Expand|Select|Wrap|Line Numbers
  1. $ftp = Net::FTP->new($site, Debug => 0)
  2. $ftp->login($un,$pwd);
  3.  
  4. $free = @comm[1];
  5. @list = $ftp->ls($free); # I get the error here !
  6. foreach (@list){
  7. print "\n".$_."\n";
  8. }
  9. prwrkdir();
  10. comm();
  11.  
This line:

Expand|Select|Wrap|Line Numbers
  1. $free = @comm[1];
  2.  
should read:

Expand|Select|Wrap|Line Numbers
  1. $free = $comm[1];
  2.  
When you reference an element of an array, the @ changes to a $.

Also, make sure that $comm[1] resolves to a directory as that is what ls() is expecting.


Regards,

Jeff
Jan 9 '08 #2
karthikeyanck
23 New Member
This line:

Expand|Select|Wrap|Line Numbers
  1. $free = @comm[1];
  2.  
should read:

Expand|Select|Wrap|Line Numbers
  1. $free = $comm[1];
  2.  
When you reference an element of an array, the @ changes to a $.

Also, make sure that $comm[1] resolves to a directory as that is what ls() is expecting.


Regards,

Jeff
Thx a lot !!! it worked :D
Jan 9 '08 #3
KevinADC
4,059 Recognized Expert Specialist
Thx a lot !!! it worked :D
What Jeff said is true, but it would not have fixed your problem. Either you added the "use Net::FTP;" line or the $ftp object is now getting created when you run the new() method. Did you not have $site defined?
Jan 9 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Matt | last post by:
I think this is the basic concept in ASP server-side development. My boss told me web application is NOT client-server application. I argued with him because browser is the client, and the server...
15
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do...
18
by: cjl | last post by:
Hey all: I know that it is silly in the age of Google to 'lose' something on the internet, but I recently checked out a project that had implemented a database with a subset of SQL in pure...
2
by: Raquel | last post by:
How do I know whether the 'runtime client' and the 'application development client' are installed on my machine? When I issue the command "db2licm -l", it gives the following output: Product...
6
by: Ken Allen | last post by:
I am relatively new to .Net and C#, but I hav ebeen programing in other languages and done some COM work for a number of years. I am attempting to understand how to map an older program...
4
by: rs | last post by:
how I the client tell the server that the socket is closed? or this there an even that informs the server that the clients socket is close? Oh, I am using vb.net 2003 Thanks
2
by: J Huntley Palmer | last post by:
I am having a horrific time integrating uw-imap's c-client for imap support in php. The problem is a whole bunch of "Text relocation remains referenced against symbol" errors during linking....
0
by: khu84 | last post by:
Here is client server very simple code, seems to work with telnet but with with web client code gives blank output. Following is the server code:- <?php function...
2
by: nsaffary | last post by:
hi I hava a client/server program that run correctly when i run it in one computer(local) but when I run client on a one computer and run server run on another, connection does not stablish.(I set...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.