Hooking BEGIN blocks, sort of

jjore on 2007-06-22T21:45:12

I had a sort of epiphany just now. If I've got control of the runloop then I can perhaps hook BEGIN blocks. Here's a little sketch. I already posted this to perl5-porters but felt like I wanted to say this elsewhere. Not all internals hackers or interested parties hang out there. Or here for that matter.

use Runops::Trace;
sub TRACE { print "$_[0]\n" }
BEGIN { Runops::Trace::enable_global_tracing( \ &TRACE ) }
BEGIN { $gvsv = 'const' }

leavesub nextstate # BEGIN { const gvsv sassign leavesub # } nextstate leavesub


Josh