The browser is a very poor debugging mechanism for CGI simply because it displays nothing about errors unless you are sure to throw in
CGI::Carp (which is recommended). Also, if you screw up your headers, you'll have NO idea of what's going on since the web server or browser will end up with some confusing info. In short,
use CGI;
use CGI::Carp qw/fatalsToBrowser set_message/; #read more about these
+in the docs link above
alarm($x); #if you wish, though I consider this a quick hack since a h
+eavy server load may actually force your users to wait this long even
+ though there is no infinite loop and still get the info they wanted
+cut off
The best solution is to test all CGI beforehand with interactive mode or the debugger ("or" is not a mutually exclusive term- that's "xor" which i would have written if I had meant that). Interactive mode is enabled when you run your CGI script from the command line. This also allows you to easily pass batch CGI params by storing them in a file instead of typing and retyping them in a browser.
perl cgi.cgi<batch\ file\ with\ \\n\ delimited\ CGI\ params.file
(Oh geesh! I wrote coed instead of code before- I wonder what I was thinking about....)
AgentM Systems nor Nasca Enterprises nor
Bone::Easy nor Macperl is responsible for the
comments made by
AgentM. Remember, you can build any logical system with NOR.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.