in reply to How to turn a "developer code" into a "user code"
I tend to prefer command-line switches (I use --DEBUG). You can then conditionally load modules as appropriate using require or eval (you could of course, build your conditional using your $I_AM_DEV, but I personally find command line switches far more elegant and less annoying than modifying code to enable/disable such things). Example:
use Getopt::Long; my %OPT; GetOptions \%OPT, qw/ help|h DEBUG / or ($OPT{help} = 1); if ($OPT{DEBUG}) { # whatever you like: require Data::Dump; eval "use Carp::Always"; } ... say "Got some data:\n", Data::Dump::pp(\%my_data) if $OPT{DEBUG};
Good Day,
Dean
|
---|
In Section
Seekers of Perl Wisdom