Quizling has asked for the wisdom of the Perl Monks concerning the following question:


<bigger>Is there a better way to interactively debug a CGI script running under mod_perl?</bigger>

After plenty of futzing, I have the interactive perl debugger popping up...phew. I'd like to get DDD or ptkdb working on this.

So, how do YOU debug CGI under mod_perl?

Replies are listed 'Best First'.
RE: Debugging CGI under Mod_Perl
by btrott (Parson) on Nov 15, 2000 at 08:59 UTC
    Well, to quibble slightly, if you're running under mod_perl you're not running a CGI--you're running either under Apache::Registry or as a custom handler, I would assume. But anyway...

    How do I do debugging in mod_perl? Loads of warn statements, usually. :)

    Seriously: while I do actually like using the perl debugger from the command line, I've never played around much with using it from mod_perl. I just rely on writing things to the error log, then taking a look at it; using a per-request trace variable that I can write to and view at the end of a request; etc.

    And it really depends *what* you're trying to debug. If you're trying to debug mod_perl itself--if something's going wrong internally that you can't figure out--try turning on mod_perl trace. You can enable the trace for various pieces of mod_perl operation (configuration setup, request handling, etc.), so it can be useful.

    If you're debugging stuff about the environment, the request, etc. take a look at Apache::DebugInfo. Or you might want to look at the Debugging mod_perl section of the guide.

    But odds are you're debugging something that you wrote. In such cases, as I said, I just tend to use the old standby: print and warn statements. :)