[plug] Perl CGI scripts
Christian
cpayne at q-net.net.au
Wed Nov 4 11:11:06 WST 1998
On Tue, 3 Nov 1998, P Robinson wrote:
> I'm just venturing into Perl CGI scripts, well CGI scripts in general, and
> am having a few problems.
> To summarize my problems, internet.au had a quick article about CGI in
> their november issue, I tried to replicate thier initial form to get it
> working so I could mess around with it too produce something I could use
> and expand for my own requirements.
> Anyway they didn't really cover everything, so I made the assumption
> that the script should be world executable and reside in the cgi-bin dir
> but it still doesn't work.
> Can someone give me some general pointers to help me start out, and
> possibly an example. Once I get going I'm usually fine, its just the mag
> is stupid and just gives you the two sample files and a general intro to
> CGI which I already knew.
I'll just add my (useless) two cents worth... :)
Firstly you've been pretty vague about what the problem is you're having
(hence so many different replies) and this is a very typical problem with
writing CGIs - since it's being executed by the web server you don't get
the same sort of feedback - "Internal Server Error" doesn't tend to be
particularly enlightening. :)
My suggestions are that if you're using Perl, test the program yourself
firstly by running: perl -wc <filename> over it. This will syntax check
your code plus issue warnings and is usually useful for picking up the
more basic errors. You can also try just running the program at the
command line, assuming this won't do anything wacky.
Another thing that's useful is to tail your httpd's error log in another
window when running the CGI - that way you get the same sort of feedback
you would get if you were running the program interactively. It can also
be useful to write stuff to stderr (print STDERR "Error message";) for the
purpose of debug printing and tracing the execution of your script.
At this stage I can't think of any more CGI debugging tips, especially
without knowing what CGI library you're using (eg cgi-lib.pl/CGI.pm etc.)
but I find what I've mentioned above tend to help me find the more basic
problems with my scripts.
If I can help more, feel free to mail me.
Regards,
Christian.
More information about the plug
mailing list