in reply to Catching CGI Errors

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.

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.