Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Making my own control flow structure

by dtr (Scribe)
on Oct 09, 2006 at 17:01 UTC ( [id://577224] : note . print w/replies, xml ) Need Help??


in reply to Making my own control flow structure

Have you ever seen the Runops::Switch module (available from the CPAN).

That module allows you to override the way that perl interprets its opcodes.

I *imagine* that you could combine the techniques used in that module, together with the B::Deparse module in order to do what you want.

From what I remember, all "if" and "unless" statements in perl are internally translated into "AND" (or "OR") statements. So:- if(i > 3) { print "bob" } is internally the same as i > 3 && print "bob". So you probably want to start by looking at overriding the OP_AND opcode....