Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange Perl-problem using Net::FTP

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hi,

I have a script which worked well a few days ago and now is driving me crasy. I cropped down the problem to this:

#!/usr/bin/perl

use Net::FTP;
$ftp= Net::FTP -> new ("192.168.111.166");
$ftp->login('spec','heck');
$ftp->quit;
print "Content-type: text/html\n\n";
print "Passed";
exit 0;

Running the script from command line works just fine. If I try to call it via apache (127.0.0.1/cgi-bin/ftptest.pl ) if crashes and prints out this message:
Can't call method "login" on an undefined value at /usr/local/httpd/cgi-bin/ftptest.cgi line 5.
[Fri Nov 3 15:40:42 2000] [error] [client 192.168.111.1] Premature end of script headers: /usr/local/httpd/cgi-bin/ftptest.cgi

It must be something silly. I rebooted, re-built perl perl-5.6.0.
 
try:

$ftp=Net::FTP->new("192.168.111.166")
or die "can't create Net::FTP object\n$!\n";

and see what error you get.

It's as if Perl has a different @INC when called from within Apache.

I'm not an Apache kind of guy but isn't there something called mod_perl that you use from with Apache? I think that Apache has its *own* version of the Perl interpreter, are you using that?

Mike
michael.j.lacey@ntlworld.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top