in reply to removing debugging code at compile time ?
The way you have the code I think the easiest solution would be to change the meaning of the LVLx constants from "the ID of the level" (where most likely LVL1 == 1, LVL2 == 2, etc.) to "is the debug for this level turned on?". So that you could change your debug statements to
You'd have to change the debug() subroutine to justdebug "this..." if LVL1; ... debug "that .." if LVL3;
and make sure the LVLx constants are defined in time ... either by enclosing the debug level setting and constant definition in a BEGIN{} block or by doing that in a module you use on top of the program. Something likesub debug { print "$_\n" for @_; }
BEGIN { ... read the levels that should be ON to %debug for (1.. $count_of_levels) { eval "sub LVL$_ () {$debug{$_}};"; } }
HTH, Jenda
|
Support Denmark! Defend the free world! |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: removing debugging code at compile time ?
by rootcho (Pilgrim) on Jun 08, 2007 at 21:41 UTC | |
by Jenda (Abbot) on Jun 09, 2007 at 08:35 UTC |