Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Hacking the perl core. Where to begin?

by shotgunefx (Parson)
on Jun 25, 2002 at 17:09 UTC ( #177140=perlmeditation: print w/replies, xml ) Need Help??

I've been contemplating for awhile delving into the bowels of Perl and was wondering if anyone had advice on where to start. I've read perlguts, perlapi and perlintern and browsed the source but it's a bit overwhelming.

Once upon a time I did nothing but C & Assembler but it's been awhile now so I was wondering if anyone had suggestions on a good starting point, it would be appreciated. For myself it's a bit difficult without having a roadmap.



"To be civilized is to deny one's nature."

Replies are listed 'Best First'.
Re: Hacking the perl core. Where to begin?
by kvale (Monsignor) on Jun 25, 2002 at 17:28 UTC
    You will also want to read the perl5 porter FAQ and the perlhacktut is also a valuable reference for hacking the core.

    For a program as large as perl, just reading the source in one go is just overwhelming and is not going to teach you much. I recommend looking at just one aspect, say a single perl function, and figure out where it resides and how it is built into the rest of the program. You will quickly get a feel for the general flow of perl, if not all the details, and this will allow you to bootstrap yourself to a level such that you can start making some changes. If you really get into it, I recommend joining p5p and searching their archives at p5p archives .

    Good luck!

      Thanks for the tips. It's certainly overwhelming (for me anyways). Hard to get a top down perspective on it.


      "To be civilized is to deny one's nature."
Re: Hacking the perl core. Where to begin?
by ferrency (Deacon) on Jun 25, 2002 at 21:09 UTC
    I think both of the previous responses to your question make a lot of sense, possibly more sense than my suggestions. But I'm going to throw them out there anyway :)

    Two more ways to get into hacking perl guts:

    1. Start with XS
    I first gained familiarity with perl's guts by getting some C code working in perl using the Swig tool, which was unfortunately not quite adequate for my needs at the time. Gluing some additional code into perl via XS or Swig extensions can introduce you to some of the basics of the perl guts, without drowning you. It also lets you compile additional useful functionality onto perl, instead of modifying something which mostly works to begin with.

    2. Go directly to perl 6
    In the long run, perl6 guts knowledge may be more useful than perl5 guts knowledge. If you don't have a particular need to know perl5 in the near future, you might want to volunteer some time to help make perl 6 a reality.

    Or maybe not, who knows :)



      Thanks. I think as far as point 2, I'm more interested in the now. I think perl5 will be around for abit. perl6 looks good but the death is in the details. Depending on what happens in the dev, I might never move up.


      "We fear change"
Re: Hacking the perl core. Where to begin?
by chromatic (Archbishop) on Jun 25, 2002 at 19:53 UTC
    Pick a promising bug. Write a minimal test case for it. Then make the test pass. (You should probably install bleadperl and get used to compiling that, too. I believe that process is described in perlhacktut.)
Re: Hacking the perl core. Where to begin?
by samtregar (Abbot) on Jun 25, 2002 at 22:12 UTC
    I'm surprised no one has mentioned it so far, but Simon Cozen wrote an awesome tutorial on Perl Internals available here. Soon his book on the subject will be out, and I'm sure that will be even better.

    In the meantime, do as much XS (and Inline::C) hacking as you can manage. Almost everything you learn about XS will be useful in the Perl core and the documentation is generally much better.


    PS: See, I can pimp other peoples' books too!

      Thanks, the tutorial looks very helpful. (Only skimmed it so far)

      Can't wait for the book. I'm sure there are alot of curious people who just don't know where to begin.


      "To be civilized is to deny one's nature."
Re: Hacking the perl core. Where to begin?
by BrentDax (Hermit) on Jun 27, 2002 at 20:47 UTC
    I learned Perl internals basically by subscribing to perl5-porters, reading most of the traffic, and reading the patches. By reading the patches and the descriptions of what they did, I was able to get a feel for where theings were in the core. Next, I did a couple small projects. Once I felt comfortable with the core, I picked something I wanted to implement and did it.

    --Brent Dax
    There is no sig.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://177140]
Approved by broquaint
Front-paged by samtregar
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2018-06-21 23:58 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (120 votes). Check out past polls.