Overriding qx//

Luke Ross luke at lukeross.name
Wed Apr 12 20:11:49 BST 2006


Hi,

On Thu, Apr 13, 2006 at 02:03:32AM -0700, Nik Clayton wrote:
> I've just discovered that I've reimplemented something very similar to
> Richard Clamp's Devel::System module (see slides 21-25 of
> http://miltonkeynes.pm.org/talks/2006/03/nik_clayton_testing_legacy_code.pdf).
> 
> But it looks like both our efforts have the same problem.  Namely, they
> don't deal with code run through qx// or backticks.

Whilst not something to be done if you value efficiency, you could use 
Filter::Simple and PPI. I've been writing a module that needs to do more 
than can be achieved with overloading and so have tried this out. Using 
PPI, you can inspect the parse tree for interesting constructs, and then 
rewrite them as function calls to carry out the new behaviour at 
runtime (yes, I know this is a bit icky).

Regards,

Luke


More information about the london.pm mailing list