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

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.
  • I'm also having trouble doing this. The best reference I've found so far is Simon's 'use Python' paper in last year's TPC proceedings. He has an example of creating a new anonymous sub, calling svref_2object() on it, and manipulating its START and ROOT ops.

    I can get pretty close, but never quite avoid the segfaults. It probably doesn't help that I'm trying to pass the rewritten subref to B::Deparse, either.

    • Thanks for the tip. I had read Simon's paper last year when I got into this project (and scanned it at TPC), but had completely forgotten that he did just what I wanted in the paper. I've now got working code that creates an anon. sub which contains the code from the main_cv (minus the enter and leave ops). Little tweaks are necessary for things like constants that are optimized away and need to be reset with the sv method, but it looks to be working.

      Thanks again!
      • I'm glad to help. Is there a chance you'd be willing to share the code? I'm curious to see another example. (I don't have unfolded constants yet, and that would be handy.)

        • Sorry about the delay in responding. I'd be happy to post my code, but it was a bit of a hack, and I've just recieved an email from Simon describing how to do it the right way [perl.org] (for some definition of right).