in reply to Conditional Interpretation?
dbg and expensive_test();
Another similar module is ctflags (that stands for "compile time flags"), it is overly complex with too many options... but for what you need:
In some place, at the beggining of your script, include this code to set flags from an environment variable:
then in every module where you want to conditionally execute something add:use ctflags::parse ns => "myapp:debug", env=>'MYAPPDEBUG';
Finally, if you call your script asuse ctflags prefix=>'dbg_', 'myapp:debug:*'; dbg_a and print "a flag is on\n"; dbg_b and print "b flag is on\n"; dbg_c and print "c flag is on\n";
it will output$ MYAPPDEBUG=ac perl myapp.pl
a flag is on c flag is on
|
|---|