in reply to Re: Easy, elemental, but cool debug trick.
in thread Easy, elemental, but cool debug trick.
2 comments. I use:
$debug = 20;
print "debug info here\n" if $debug > 5
print "even more info here\n" if $debug > 10
etc.
which lets me turn on and off levels of debug during
the process (e.g. subroutines can dump details or just
announce their presence as they get 'better' throughout
the scripting). I try to write these sorts of debug
stmts at the beginning and leave them in (often for
years ;-) as experience shows I'll need them later and
often need to turn them back on or bump the levels back
up as things change.
The other thing I just saw was somebody wrote all there
constant comparisons:
if ( 6 == $value ) { ...
claiming that this "catches" the missing "=" problem at
compile time (can't do 6 = $value) w/o the -w. Not sure
I believe its a good thing (ugly for one, reads wrong)
and not sure '6' shouldn't be $value_if_this sort of
constant somewhere (in most cases) but the fellow is
very accomplished programmer so take it for what you
will.
a