Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 12-02-2010
Member
 
Join Date: Jan 2010
Posts: 44
Creating graphical ftp client with Perl using class NET:: FTP

I am creating a graphical ftp client with Perl using class NET:: FTP, and for that I want to try get function on an ftp server G6FTP Server. But I don't know how to create files on that server and how can I connect from my perl script? Though I found some examples that connects to a ftp site, but in the case of local server I must connect with the IP address domain or something like that? Do I need stp help?

Here is my code:
Code:
#!/usr/local/bin/perl
use Net::FTP;
my $server = '127.0.0.1';
my $source = 'Main log';
my $ftp = Net::FTP->new($server);
$ftp->cwd("/Logs & Reports");
$ftp->get("$source");
$ftp->quit;
exit 0;
Reply With Quote
  #2  
Old 12-02-2010
Member
 
Join Date: Nov 2008
Posts: 1,221
Re: Creating graphical ftp client with Perl using class NET:: FTP

some correction in your code
Code:
#!/usr/bin/perl
use warnings;
use strict;
use Net::FTP;
 
my    $ftp = Net::FTP->new("some.host.name", Debug => 0)
      or die "Cannot connect to some.host.name: $@";
 
    $ftp->login("anonymous",'-anonymous@')
      or die "Cannot login ", $ftp->message;
 
    $ftp->cwd("/pub")
      or die "Cannot change working directory ", $ftp->message;
 
    $ftp->get("that.file")
      or die "get failed ", $ftp->message;
 
    $ftp->quit;
Reply With Quote
  #3  
Old 12-02-2010
Member
 
Join Date: Jan 2010
Posts: 44
Re: Creating graphical ftp client with Perl using class NET:: FTP

I did according to the documentation of Net:: FTP, but I want to know if the portion of the code is correct or not:

my $ftp = Net::FTP->new('127.0.0.1');

I mean to connect by IP address of FTP server in that way.
Reply With Quote
  #4  
Old 12-02-2010
Member
 
Join Date: Nov 2008
Posts: 1,221
Re: Creating graphical ftp client with Perl using class NET:: FTP

Net:: FTP look's pretty, but is it possible to use it from a Linux computer to fetch a file (more precisely an archive) on a PC running on windows?

Quote:
but I want to know if the portion of the code is correct or not
yes, if there is a ftp server on this PC. If you are able, from your Linux console, to connect to FTP on your PC, then with Net:: FTP, you can.

Did you test?
Reply With Quote
  #5  
Old 12-02-2010
Member
 
Join Date: Jan 2010
Posts: 44
Re: Creating graphical ftp client with Perl using class NET:: FTP

OK, I tested but I have a problem, the connection is refused.
Code:
#!/usr/bin/perl
use strict;
use warnings;
use Net::FTP;
 
my $ftp = Net::FTP->new("192.168.0.50")
      or die "Cannot connect to '192.168.0.50': $@";
	  
$ftp->login("login","mdp")
      or die "Cannot login ", $ftp->message;
	  
$ftp->cwd("path/linux")
      or die "Cannot change working directory ", $ftp->message;
 
$ftp->get("path/windows/archive.tar.gz") 
      or die "get failed ", $ftp->message;
	  
$ftp->quit;
And I have this error message:

Quote:
Can not connect to '192 .168.0.50 ': Net:: FTP: connect: Connection refused at ftp.pl line 6.
Hence it may come?
Reply With Quote
  #6  
Old 15-02-2010
Member
 
Join Date: Feb 2010
Posts: 2
Re: Creating graphical ftp client with Perl using class NET:: FTP

Hello,

There is a free FTP client in Perl :

It's released under the GNU GPL license so you can use it or modify it,
don't hesitate if you have any questions or comments,

Regards

Last edited by rupesh : 15-02-2010 at 11:23 PM. Reason: Link Removed
Reply With Quote
  #7  
Old 16-02-2010
Member
 
Join Date: Feb 2010
Posts: 2
Re: Creating graphical ftp client with Perl using class NET:: FTP

Quote:
Originally Posted by revy View Post
Hello,

There is a free FTP client in Perl :

It's released under the GNU GPL license so you can use it or modify it,
don't hesitate if you have any questions or comments,

Regards
For info the script can be found on SourceForge, it's called "Perl FTP Client".

You can read the script from SourceForge, it can certainly help you understand how to use Net::FTP.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Creating graphical ftp client with Perl using class NET:: FTP"
Thread Thread Starter Forum Replies Last Post
Creating a generic class in dot net Vedic Software Development 4 16-02-2011 08:51 AM
Creating a vector type of a class Xmen Software Development 5 24-02-2010 03:38 AM
Creating a daemon using Perl Sahira Software Development 4 12-02-2010 11:57 AM
Gauge Class for creating Volume Bar Adrina_g Software Development 3 10-12-2009 09:57 AM
Creating an array from a class Kingfisher Software Development 3 25-11-2009 02:50 PM


All times are GMT +5.5. The time now is 01:23 PM.