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. :)


In reply to RE: Debugging CGI under Mod_Perl by btrott
in thread Debugging CGI under Mod_Perl by Quizling

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.