473,410 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

error in simulating an ftp client in perl

i am using array to store a command given at run time by user... and execute it.....but after a connection is made to any ftp sites only 'ls' or 'dir' commands work....and if i wish to change directory or get any file or put file.example
get("123.mp3")
put("abc.txt")
cd user
etc or any commands that has space in between
then it gives error.wat i cn do to get or put files ...


Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use Net::FTP;
  4.  
  5.         print("\nHost\/IP: ");
  6.         $host = <STDIN>;
  7.         chomp ($host);
  8.  
  9.         print("\nUsername: ");
  10.         $username = <STDIN>;
  11.         chomp ($username);
  12.     print "Password: ";
  13.     chop ($password = <STDIN>);
  14.     `stty echo`;
  15.     print "\n";
  16.  
  17.  print("Connecting to $host...\n");
  18.  my $ftp = Net::FTP->new($host) or die "Couldn't connect to $host\n";
  19.  print("Connected!\n");
  20.  print("\nFTP>");
  21.  
  22.  $ftp->login($username, $password)
  23.  or die "Could not log in .\n";
  24.  
  25.  rep:
  26.  
  27.  $command = <STDIN>;
  28.  
  29.  chomp ($command);
  30.  
  31.  unless ("$command" eq "bye") {      
  32.  
  33.  
  34.                   @listing = $ftp->$command;
  35.  
  36.                   for($i=0;$i<@listing;$i++) { print "$listing[$i]\n"; }
  37.  
  38.                   print("FTP>");
  39.  
  40.                   goto rep;
  41.  
  42.                                }
  43.  
Attached Files
File Type: txt ftp.txt (944 Bytes, 383 views)
May 1 '10 #1
0 1111

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

Similar topics

2
by: PapaBear | last post by:
Hi y'all, I'm handling Apache errors through seperate shtml files. That surely looks better than the standard error pages by the browser etc. I did this by coding in httpd.conf lines like: ...
2
by: NotNeo | last post by:
I am getting a strange symptom: tnsping and sqlplus work fine on my LINUX server (neo) so the listener and DB are OK. However, from my remote XP Client (tank) I get TNS-12560. I can ping the neo...
0
by: jake johnson | last post by:
I'm using Postgresql 7.3.4, FreeBSD 4.7, & Apache 2.0.47. I have a perl script which uses the DBI module and it works great from the command line as long as I have '/usr/local/pgsgl/lib' in...
0
by: Aaron | last post by:
Hi Guys, I have a dbase installed on a network where the clints have linked tables to the database on the server. I found that i had to make some minor changes to the tables on the server...
5
by: Chad | last post by:
Hi, I have the following server code that attaches a client side script to the Update command of the data grid. Private Sub clientExc_ItemCreated(ByVal sender As Object, _ ByVal e As...
0
by: Rabbit | last post by:
Dear all, My application contains 2 parts(Server and Client), the server side is having a ASP.net page as listener for client side to post file, the main coding to receive posting file as...
5
by: Bjorn Sagbakken | last post by:
Hello I have just migrated from VS 2003 to VS 2005, and .NET framework 1.1 to 2.0 I am at the end of debugging and fixing stuff. Now there is one error I just cannot find a solution to: On...
3
daniel aristidou
by: daniel aristidou | last post by:
Hi i just finished a program and installed it on the client pc....when i start it up im recieving error messages Does anybody understand these and can anybody suggest a solution? ...
1
by: Jeff | last post by:
I am receiving the following error: // error: System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 No...
2
by: mithunmo | last post by:
I am trying to automate the process of filling up the webforms and do a submit . I have the below program written but If I run the program . I get the following error message Can't call method...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.