[Chicago-talk] DEBUG function
Greg Fast
gdf at speakeasy.net
Mon Mar 1 10:46:57 CST 2004
Another trick: put this DEBUG.pm (listed below) somewhere in your
@INC. Comment out any debugging-only lines by starting them with
"#DEBUG " (with trailing space), which will cause perl to compile them
away entirely. When you need the debugging lines, add a "use DEBUG;" to
your file (or -MDEBUG on the cmdline) to magically uncomment them.
--start DEBUG.pm
package DEBUG;
=pod
=head1 SYNOPSIS
use DEBUG;
#DEBUG print complex_debugging_output($_) for @huge_data_structure;
=head1 DESCRIPTION
Uncomments lines beginning with "#DEBUG " when used.
=cut
use Filter::Simple;
FILTER {
s/^\s*\#DEBUG //gm;
}
1;
--end DEBUG.pm
--
Greg Fast
http://cken.chi.groogroo.com/~gdf/
More information about the Chicago-talk
mailing list