Without using a text preprocessor or waiting for Perl 6's lazy evaluation, I don't see an easy way to turn off checking by throwing a switch. The switch would be present in each statement: if ($debug && expensive_sanity_check(x)) ...
Use a constant:
| | | use constant DEBUG => 0;
...
sub foo {
sanity_check(...) if DEBUG;
}
|
This has the nice effect of optimizing away the entire sanity check statement in production code, without employing a preprocessor/text-filter.
MeowChow
s aamecha.s a..a\u$&owag.print