in reply to Conditional Compiling

Since LOGGING is a flag rather than a true constant, why not treat it the same way as you have treated $LOG_FILE_NAME i.e. as a (read only) scalar:
*{"${caller_pkg}::LOGGING"} = \$lexical_log;

Replies are listed 'Best First'.
Re^2: Conditional Compiling
by ikegami (Patriarch) on Nov 17, 2004 at 21:52 UTC
    Because log(...) if LOGGING compiles to nothing given sub LOGGING () { 0 } (refer to the first parse tree in the OP), whereas, log(...) if $LOGGING would cause $LOGGING to be evaluated at runtime everytime the line is encountered. While that's probably a negligable cost, it doesn't meet the goal I set at the top of my post. That goal can be alternatively stated as "I want the if to execute at compile time instead of at run-time (while keeping the code simple)."
      Ok, I get it now. It's quite a cool technique which is also used by Carp::Assert (for disabling assertions).