At 08:04 PM 12/10/00 +0100, Stas Bekman wrote:
>use constant DEBUG => 0;
>...
>warn "bar" if DEBUG;

>you can keep the debug statements in the code without having any overhead
>of doing if DEBUG, since they are stripped at compile time.

Just how smart is the compiler?

Maybe all these debugging options indicate there's too much stuff in this
module, but...

use constant DEBUG_TEMPLATE          => 1;
use constant DEBUG_SESSION           => 2;
use constant DEBUG_REQUEST           => 4;
use constant DEBUG_QUERY             => 8;
use constant DEBUG_QUERY_PARSED      => 16;

my $debug = DEBUG_REQUEST|DEBUG_QUERY;

...

warn "query = '$query'\n" if $debug & DEBUG_QUERY;

Is the compiler that smart, or is there a better way such as 

use constant DEBUG_TEMPLATE          => 0;  # OFF
use constant DEBUG_SESSION           => 1;  # ON
use constant DEBUG_REQUEST           => 0;
use constant DEBUG_QUERY             => 1;  # ON
use constant DEBUG_QUERY_PARSED      => 0;

warn $query if DEBUG_QUERY || DEBUG_QUERY_PARSED;



Bill Moseley
mailto:[EMAIL PROTECTED]

Reply via email to