CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
CGI Debugging made easy + more!

 



jflowers
New User

Apr 26, 2003, 7:48 AM

Post #1 of 3 (1078 views)
CGI Debugging made easy + more! Can't Post

I have always hated how difficult debugging CGI is, so I decided to do something about it. I grabbed a copy of Perl Web Server form Source Forge and went to work.
After a coupla days a hack'n I had a web server that would eval my CGI scripts and CGI::Applications. I could now set a break point in my CGI script and start the web server in the debugger. Then open a browser to port the web server is listening. This allowed me to interact with my CGI script through the browser. I find this easier than setting every thing up on the command line, especially for queries with 20 or more name value pairs.
After getting the debugging down I saw that was just the tip of the ice burg for making CGI development and debugging easier.
I modified CGI and CGI::Carp to provide the option to save all state and request information from a fatal error with Storable to a file. I added a new page to my CGI script so I could view the detailed information in the error files. As well as the ability to execute the offending request. You say why would I want to execute the falling request again? You would want to do that from the debugging web site, in the Perl Web Server debugger. Then you can quickly track down where the error is and fix it.
No more sifting through logs, or having to guess what the user did to get the error they are reporting. Get right to it, and fix it.
I have plans to add a test harness to it so in development you can create the same files the CGI::Carp creates for fatal errors and use them as the test case input. Then save and associate the output from those successful for future tests. When an error occurs on your production system you can grab the error file that CGI::Carp generated and fix the problem. After fixing the problem you make a new output file and associate it with the error file generated by CGI::Carp and run the test harness with the old and new test case to see if you broke anything while fixing the bug.

So I have some questions for anyone that is reading this. Is this so specialized a solution to my needs that others would not find much use in it? If not how do I give this to the Perl community, is it a tool, a set of libs, a hack or some combination of those choices? Do I need to contact the authors of the modules I needed to modify before I submit it to the Perl community? I just don't know what etiquette is in this situation.



Paul
Enthusiast

Apr 26, 2003, 12:30 PM

Post #2 of 3 (1077 views)
Re: [jflowers] CGI Debugging made easy + more! [In reply to] Can't Post


Quote
I have always hated how difficult debugging CGI is


You're kidding?....it's far easier than anything else I've used such as VB or C++. All fatal errors are printed to STDERR. All you have to do is look in your error log.


Quote
I modified CGI and CGI::Carp to provide the option to save all state and request information from a fatal error with Storable to a file.


A better way then editing the modules is to create a custom die wrapper using $SIG{__DIE__}


(This post was edited by Paul on Apr 26, 2003, 12:31 PM)


jflowers
New User

Apr 26, 2003, 12:49 PM

Post #3 of 3 (1073 views)
Re: [Paul] CGI Debugging made easy + more! [In reply to] Can't Post

Sure it may be easyer than other, that does not mean that it doesn't need improvment.

I don't want to repace CGI::Carp I want to add to it, for what I needed it to do it had to be in CGI::Carp. I tryed messing with the die sig but that became nasty.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives