Gossamer Forum
Home : General : Perl Programming :

What does this mean???

Quote Reply
What does this mean???
Hi. Can someone please tell me what this is refering to;

Software error:
1 at /home/ace-inst/public_html/cgi-bin/auto/links2/links2.cgi line 966.

The whole script is a bit long, so I won't post it all, just the bit I think it is refering too!

sub install

{

$ftpaddress = $query->param('ftpaddress');
$username = $query->param('username');
$password = $query->param('password');
$server = $query->param('server');
$ftpfolder = $query->param('ftpfolder');
$comments = $query->param('comments');

use Net::FTP;
$ftp =Net::FTP->new("$ftpaddress", Debug => 0) || die &error;
$ftp->login("$username","$password") || die &error;
$ftp->cwd("$ftpfolder/") || die &error;
$ftp->quit;

print "Content-type: text/html \n\n";
print "Done \n";
}



sub error

{

print "Content-type: text/html \n\n";
print "There was an error logging into your FTP server. Please recheck your information and try again.\n";

}

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: What does this mean??? In reply to
It would be easier to spot the error by making the whole script web accessible.

Do you have

use CGI qw(:standard);

and

$query = new CGI;


?

Just a quick point - it would be better to pass the correct error to the error sub using $! rather than just showing a default error all the time.

Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/

Quote Reply
Re: What does this mean??? In reply to
Yup. I do. Don't worry though, I fixed it. I just rewrote the code for that section, but in another way. That seems to have sorted it out Wink

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: What does this mean??? In reply to
It's because you are die()ing with whatever error() returns - in this case, error() is printing an error message, and print returns "1" (when successful, which is almost always). So, what you are doing is dying with a reason "1".

You could make sub error call die() itself - something like:

Code:
sub error {
print "Content-type: text/html\n\n";
print "There was an error";
die "There was an error";
}
and then in the main code:

Code:
$ftp = Net::FTP->new("$ftpaddress", Debug => 0) || error();
Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: What does this mean??? In reply to
Ahhhh, I see Smile

Thanks for that, I will have to remember that for the future Wink

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: What does this mean??? In reply to
That was fast ;-)

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: What does this mean??? In reply to
Jason,

If you are bored you could always take a look here Smile...i'm getting desperate...

http://www.gossamer-threads.com/...w=collapsed&sb=5

Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/