Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Universal test flag

by tobyink (Abbot)
on Jul 17, 2012 at 08:21 UTC ( #982176=note: print w/replies, xml ) Need Help??


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 (Friar) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://982176]
help
Chatterbox?
[marto]: good morning all

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2017-10-23 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (277 votes). Check out past polls.

    Notices?