dear monkists,

to make debugging easy, I would like to do any of the following to turn debugging on or off, specifically in a mod_perl deployed application;

I note in 2001, that this was discussed before.

My questions are thus;

thanks in advance

update

Thank you for the advice, I decided to go down the following route to get what I wanted; e.g. flexible logging, with assertions and DEBUG flag... with a roughly accurate timing mechanism.

use Benchmark::Stopwatch;
use Log::Log4perl;
use Carp::Assert;
*ADEBUG = *DEBUG;
undef *DEBUG;

the DEBUG constant is defined by both Log::Log4perl and Carp::Assert ... so I had to redefine it.

With this setup, I can reuse Carp::Assert PERL_NDEBUG env variable for controlling execution of DEBUG statements and assertions. This is easily set in either Apache using PerlSetEnv directive or setting/exporting environment variable on underlying OS

I also included benchmarking, which activates only if DEBUG is enabled

    $stopwatch = Benchmark::Stopwatch->new->start if DEBUG;

update 2 I now find that Devel::NYTProf::Apache can completely replace this approach in mod_perl apps


In reply to DEBUG redux by cutlass2006

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.