in reply to Using Perl's Debugger on

It should be clear why you can't replicate the CGI behavior from the command-line; the normal way of getting to form B is to submit an HTML form to a webserver, but there's no webserving and no submitting going on from the command line. One way of getting to form B is to give the script input that looks like it came from form A, and this is possible because CGI.pm can process arguments from the command line.

./myscript.pl foo=bar baz=bletch
will act just like
http://www.foo.com/cgi-bin/myscript.pl?foo=bar&baz=bletch

So you might look into that (I think you can even save a CGI object to a file, which would replicate the form variables; you could then read in those variables on the command line with ./myscript.pl < savefile. I'll admit to not knowing *much* about that, though.

As an aside: you don't *need* the debugger to track down the errors. Just sprinkle some print statements into your CGI routines to help you track the changes to the variables over time, that will help you localize the errors.

HTH

Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Replies are listed 'Best First'.
Re: Re: Using Perl's Debugger on
by nysus (Parson) on Apr 18, 2001 at 17:37 UTC
    Thank you, man. That did the trick! I did not know cgi.pm can process elements from the command line.

    I'm aware that one can use print to debug. However, since the root cause of this problem was my spaghetti code, "print" would have never worked in this particular case. Debug was the right tool for this job and I found the problem with it. Thanks again.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar;
    $nysus = $PM . $MCF;

      If the root cause of the problem was spaghetti code, then the root solution must be to learn to write better code...

      UPDATE
      The Monastery is full of good resources for improving. :-)

        Trust me, I'm going to work on it!

        $PM = "Perl Monk's";
        $MCF = "Most Clueless Friar;
        $nysus = $PM . $MCF;