Gossamer Forum
Home : General : Perl Programming :

Net::FTP

Quote Reply
Net::FTP
Could someone please explain to me why when running this piece of code via Telnet it gives me an error;

use Net::FTP;

$ftp = Net::FTP->new("$ftpaddress", Debug => 0);
$ftp->login("username",'password');
$ftp->site("CHMOD 666 links.db");
$ftp->quit;


The error i get when running via TelNet is;

"use" not allowed in expression at chmod.cgi line 5, near ""
syntax error at chmod.cgi line 5, near "use Net::FTP"
Execution of chmod.cgi aborted due to compilation errors.

PLEASE HELP!!!

Thanks

Andy


webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: Net::FTP In reply to
It may help if you showed us the relevant code Smile


Paul Wilson.
http://www.wiredon.net/gt/
http://www.perlmad.com/
Quote Reply
Re: Net::FTP In reply to
Sorry, the above post has now been changed to include the code i missed out Cool

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: Net::FTP In reply to
sounds like something before use Net::FTP is causing the problem..

Jerry Su
widgetz sucks
Quote Reply
Re: Net::FTP In reply to
The code i am using is;

#!/usr/bin/perl

use Net::FTP;

$ftp = Net::FTP->new("$ftpaddress", Debug => 0);
$ftp->login("username",'password');
$ftp->site("CHMOD 666 links.db");
$ftp->quit;

print "Content-type: text/html \n\n";
print "Hopefully CHMODed links.db to 666";


Andy ideas? It works in my browser, but for some reason i get the error when running via TelNet???? Frown

Andy


webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: Net::FTP In reply to
Sounds like you are running it under perl 4 from telnet. Do a perl -v to confirm.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Net::FTP In reply to
Alex his syntax is wrong.......

$ftp->login("username",'password');
$ftp->site("CHMOD 666 links.db");


It should be.......

$ftp->login("username","password");
$ftp->site('CHMOD', '666', 'links.db');

.....shouldn't it?

Paul Wilson.
Installations:
http://www.wiredon.net/gt/
Quote Reply
Re: Net::FTP In reply to
Possibly, haven't used Net::FTP in a while. But he's getting a compile error, what you mention wouldn't affect compilation. The code he pasted compiled fine on my system.

Cheers,

Alex

--
Gossamer Threads Inc.