in reply to Universal test flag

package Foo::Bar; use constant DEBUG => $ENV{DEBUG_FOO_BAR}; # ... warn "I'm being tested!" if DEBUG;

Then if you need a particular class to be debugged, set the appropriate environment variable to "1" before the class is loaded.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^2: Universal test flag
by ait (Hermit) on Jul 17, 2012 at 13:23 UTC
    Thanks! The ENV approach is really simple and clear can be set from the test script before loading the class.