Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2018-02-20 21:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (274 votes). Check out past polls.

    Notices?