I'm using CGI::Pretty to build screens for editing a data structure. On certain inputs, this was failing with an unhelpful message. To debug it, I wanted to run the program from the line debugger, so I could see the calling stack and so forth. But to re-create the error, I needed to call the cgi script with the same POSTDATA parameters.
So I wrote a small function that wrote all the 'param' parameters to a file:
which, as I intended, wrote a file that looked likeprint "#/usr/local/bin/perl\n"; foreach (param()){ print ("param('$_' , '", param($_), "'\n");}
I executed the script in the debugger and executed#/usr/local/bin/perl param('p1', 'v1'); param('p2', 'v2');...
To my surprise, no parameters had been set by reading in mydebugparam.pl. So, hacking on, I wrapped all the param calls in a function definition. I modified the code so it printed out something of the form:DB<1> require "mydebugparam.pl" DB<2> x param()
Now I performed#/usr/local/bin/perl sub sn{ param('p1', 'v1'); param('p2', 'v2');...}
and saw the parameters set as I had intended.DB<1> require "mydebugparam.pl" DB<2> sn() DB<3> x param()
Why didn't require-ing the param statements work, while wrapping them in a function def did?
Am I going about this all wrong? Is there an easier way to be debugging cgi forms that have large numbers of POSTDATA params?
thanks
throop
In reply to CGI Params in a scratch file for debugging by throop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |