Next | Tricks of the Wizards | 89 |
package Trace; use Filter::Simple;
sub trace { ... }
FILTER_ONLY code => sub { s{^(\s* sub \s+ [a-zA-Z_]\w* \s* \{)} {$1 &Trace::trace; }xmg; };
FILTER_ONLY code will not modify this:
$z = " sub z { Oh no! } ";
The code that's passed to the filter actually has
$z = \034\000\000\000\001\034;
Filter::Simple puts this back the way it was afterwards
Next | Copyright © 2003 M. J. Dominus |