Gossamer Forum
Home : General : Perl Programming :

When is an error not really an error? (CGI)

Quote Reply
When is an error not really an error? (CGI)
I run identical print qq blocks in separate scripts, and one generates a 'Bad Name' error. The script that generates the error is much bigger, and therefore needs more compilation. Does anyone know what - if any - compiler constraints I might not be observing here, because the problem is definitely not with the code. Here's the offending line, if it helps:
Code:
<A onMouseOver="z.src ='img1.jpg'" onMouseOut="z.src='img2.jpg'" HREF="http://www.foo.org/path/file.html">
The bad name is after jpg', and that's the first jpg' in the line.
Quote Reply
Re: [SandyM] When is an error not really an error? (CGI) In reply to
Double check your operators.

Make sure that you have closed and opened your print statements correctly, like:

print qq|CODES|;

OR

print qq~CODES~;
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] When is an error not really an error? (CGI) In reply to
Operators aren't the problem: the code compiles and runs perfectly well... sometimes. As I said, I have two scripts containing identical functions. The smaller one works fine, but the larger one generates a compilation error in that very function...
Quote Reply
Re: [SandyM] When is an error not really an error? (CGI) In reply to
This is not a fix for your problem, but, have you tried running the code with -w turned on? It provides nitpicky diagnostic messages about things that may cause problems later on. Though it's not a solution, it may be helpful in cleaning code up.

As well, if you can, try to run things with "use strict;". (Though a great many scripts don't run with it, so you may not be able to use it)
Quote Reply
Re: [SandyM] When is an error not really an error? (CGI) In reply to
You'll need to post a larger chunk of the code for us to be able to spot the problem.
Quote Reply
Re: [Aki] When is an error not really an error? (CGI) In reply to
Both scripts have -w turned on, and both use the strict pragma.
Quote Reply
Re: [Paul] When is an error not really an error? (CGI) In reply to
Fixed, if not really understood. There was a separate error that I isolated: I was setting a cookie and then redirecting the browser and ended up printing 2 headers. I changed the redirect line to
Code:
print $cgiobj->start_html(-head=>meta({-http_equiv =>'refresh', -content=>"0; url=$url"}))
and everything worked fine. This is a bit 'flickery', but it will do the job.

Still, after all that, I'm quite interested to read up on exactly how the compiler goes about its business, if anyone knows of a decent resource for that information. Thanks to everyone who responded.
This forum is a good one - I found the redirect fix here - and I'll keep visiting.