A bit off-topic, but related:
Another thing which often causes problems is being having trouble debugging the scripts once they run properly. Debugging from the command line can be tedious, or, in the case of scripts that with high security or requiring cookies, virtually impossible without sprinkling your code with a bunch of print statements.
To solve that problem, I once hacked together a module that allowed one to easily dump CGI variable data to the browser. It was a cheap hack designed for my personal use, but I put it on this site in case anyone could use it. It has full POD included, but it does have a couple of problems.
- It creates a table with the data in question, but prints that data directly to the screen rather than returning it in a scalar. This caused problems with it sometimes destroying the layout of the page.
- The other issue is that it did not handle logging the data as opposed to returning it. When I mentioned my module on Usenet, brian d foy was of the opinion that he thought it wasn't terribly useful in its present incarnation, but it might be useful if it wrote the data to another file.
Currently, I am working on Version 3.01 of the module. It will return the table instead of printing it directly (which it should have done in the first place). Also, if you specify a filename when instantiating the object, it writes the data to an HTML document with said filename. Run the the main script, switch to a browser pointing to the debugging HTML document and hit refresh. Voilá, as many tables as you like, with all variables that you'd like to examine. The module uses Data::Dumper for formatting data.
If any monks are interested in the new version (bugs and all), I'd be happy to provide them with a zipped copy. If I ever get the time to return to it and finish it up, I'll create a proper tar archive with tests that one can run "make" on.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
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.