[sf-perl] Debugging a CGI script - how
doom at kzsu.stanford.edu
Sat Mar 8 12:32:02 PST 2008
Neil Heller <nheller at silcon.com> wrote:
> I've been modifying a CGI script and have run into a problem that bring to
> mind a larger question.
> My script uses data from a relational database to pull information about
> external files. The script then displays information from the relational
> database and the contents of the external file. The script then continues
> on the next iteration - each iteration equals one entry in the relational
> If there are 3 or fewer entries in the relational database, the script works
> well. At the fourth entry in the relational database, Apache throws an
> error and the user (me at this point) receives only a generic-type error.
> Does anybody have any ideas about how to best go about finding the error?
Have you checked the apache error log? Where are you seeing this
"generic error message"?
Note that if you toss in statements like:
print STDERR "The value is: $value at " . __LINE__ . "\n";
That output should show up in the apache error log.
At a guess, you should look at the data involved more closely: I would
guess there's something in your fourth record that's messing you up,
and you need to be more careful with quoting or using bind parameter
("?" placeholders) or something like that.
Try some runs with different data, organized in different ways.
I also might suggest that at some point you shoule spend some time to
learn how to use the perl debugger, but that admittedly can be a bit
of a pain in a web context.
You might try to cut down your code the smallest example that reproduces
the problem, then you could post the code here, and we'll look it
More information about the SanFrancisco-pm