Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: The B:: Modules

by jweed (Chaplain)
on Jan 25, 2004 at 22:04 UTC ( #324021=note: print w/ replies, xml ) Need Help??


in reply to The B:: Modules

Check out this article from perl.com. It looks like it may provide the info on op-trees you're looking for.

Also note that I found this page as the first search result on google for B::Generate perl tutorial.

HTH.




Code is (almost) always untested.
http://www.justicepoetic.net/


Comment on Re: The B:: Modules
Re: Re: The B:: Modules
by stvn (Monsignor) on Jan 25, 2004 at 23:19 UTC
    Jweed,

    Thanks, I actually think i read this article back when it first came out. I think I will give it a read again. Thanks.

    Update: I went back and tried with your Google search params, I noticed it was the first and pretty much only relevant link on there (except for something by chromatic which I have bookmarked for after the kids are in bed). Maybe I should start looking for info about the perl C code, and just transpose it to Perl?

    -stvn
      1. Write the Perl code you want to produce.
      2. Dump it to opcodes with B::Concise.
      3. Write the Perl code you want to transform.
      4. Dump it to opcodes.
      5. Figure out the difference between #2 and #4.
      6. Write the B::Generate code to produce those opcodes.
      7. Fiddle with stuff until it stops segfaulting.
      8. Fiddle with stuff until it stops running into an infinite loop.

      For extra credit, fiddle with stuff until it produces the right answer. If you reach this step, please tell the rest of us how you did it!

        chromatic,

        Thanks, I started to doing this earlier today, and then just got stuck on trying to get plain old B to print out the innards of my subroutines (building off Simon's tutorial's examples). I think I read about half the code in B::Deparse before I managed to hit something similar to the infinite loop you speak of in Step 8.

        I also kept encountering a package B::SPECIAL, for which I saw no listing in B documentation for, but did find in the source that is was just a plain old B::OBJECT. Anyone know what this refers too?

        -stvn

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://324021]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2014-12-19 22:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (93 votes), past polls