in reply to removing debugging code at compile time ?

If DEBUG is a defined, in scope constant like the ones created by constant (i.e. a sub containing a constant expression with a () prototype), then, DEBUG and .... will probably prune the code if DEBUG is false due to code folding.

As far as I know, that's the best you can do with current production-ready perls, unless you want to go into the mess that's source filters.

update: if you have the stomach, take a look at the -P option in perlrun.

Replies are listed 'Best First'.
Re^2: removing debugging code at compile time ?
by rootcho (Pilgrim) on Jun 01, 2007 at 22:36 UTC
    from the docs you pointed it seems that even if I use this :
    debug "text", LVL1 if DEBUG;
    instead of this :
    DEBUG and debug "text", LVL1;
    it will still prune the debug() call at compile time (if DEBUG is 0, of course), right ?