Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of jjore (6662)

Friday June 22, 2007
04:45 PM

Hooking BEGIN blocks, sort of

[ #33582 ]

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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.