in reply to Instrumenting code for debugging.
sub debug ($) {0;} # constant subroutine gets inlined for speed sub set_debug { # set your options... no warnings; *{My::Package::debug}{SUB} = sub { # your debugging subroutine goes here } }
The idea being that unless set_debug is called, your debug calls don't take up any time because they are inlined by the compiler. For this you do require (1) constant-length argument lists to your debug subroutine and (2) NOT using a debug 'object', because then (I think) subroutine argument signatures don't work.
andramoiennepemousapolutropon
|
|---|