perlhack - How to hack at the Perl internals
This document attempts to explain how Perl development takes place, and ends with some suggestions for people wanting to become bona fide porters.
The perl5-porters mailing list is where the Perl standard distribution is maintained and developed. The list can get anywhere from 10 to 150 messages a day, depending on the heatedness of the debate. Most days there are two or three patches, extensions, features, or bugs being discussed at a time.
A searchable archive of the list is at:
The list is also archived under the usenet group name
List subscribers (the porters themselves) come in several flavours. Some are quiet curious lurkers, who rarely pitch in and instead watch the ongoing development to ensure they're forewarned of new changes or features in Perl. Some are representatives of vendors, who are there to make sure that Perl continues to compile and work on their platforms. Some patch any reported bug that they know how to fix, some are actively patching their pet area (threads, Win32, the regexp engine), while others seem to do nothing but complain. In other words, it's your usual mix of technical people.
Over this group of porters presides Larry Wall. He has the final word in what does and does not change in the Perl language. Various releases of Perl are shepherded by a ``pumpking'', a porter responsible for gathering patches, deciding on a patch-by-patch feature-by-feature basis what will and will not go into the release. For instance, Gurusamy Sarathy is the pumpking for the 5.6 release of Perl.
In addition, various people are pumpkings for different things. For instance, Andy Dougherty and Jarkko Hietaniemi share the Configure pumpkin, and Tom Christiansen is the documentation pumpking.
Larry sees Perl development along the lines of the US government: there's the Legislature (the porters), the Executive branch (the pumpkings), and the Supreme Court (Larry). The legislature can discuss and submit patches to the executive branch all they like, but the executive branch is free to veto them. Rarely, the Supreme Court will side with the executive branch over the legislature, or the legislature over the executive branch. Mostly, however, the legislature and the executive branch are supposed to get along and work out their differences without impeachment or court cases.
You might sometimes see reference to Rule 1 and Rule 2. Larry's power as Supreme Court is expressed in The Rules:
Got that? Larry is always right, even when he was wrong. It's rare to see either Rule exercised, but they are often alluded to.
New features and extensions to the language are contentious, because the criteria used by the pumpkings, Larry, and other porters to decide which features should be implemented and incorporated are not codified in a few small design goals as with some other languages. Instead, the heuristics are flexible and often difficult to fathom. Here is one person's list, roughly in decreasing order of importance, of heuristics that new features have to be weighed against:
If you're on the list, you might hear the word ``core'' bandied around. It refers to the standard distribution. ``Hacking on the core'' means you're changing the C source code to the Perl interpreter. ``A core module'' is one that ships with Perl.
The source code to the Perl interpreter, in its different versions, is kept in a repository managed by a revision control system (which is currently the Perforce program, see http://perforce.com/). The pumpkings and a few others have access to the repository to check in changes. Periodically the pumpking for the development version of Perl will release a new version, so the rest of the porters can see what's changed. The current state of the main trunk of repository, and patches that describe the individual changes that have happened since the last public release are available at this location:
Selective parts are also visible via the rsync protocol. To get all the individual changes to the mainline since the last development release, use the following command:
rsync -avuz rsync://ftp.linux.activestate.com/perl-diffs perl-diffs
Use this to get the latest source tree in full:
rsync -avuz rsync://ftp.linux.activestate.com/perl-current perl-current
Needless to say, the source code in perl-current is usually in a perpetual state of evolution. You should expect it to be very buggy. Do not use it for any purpose other than testing and development.
Always submit patches to email@example.com. This lets other porters review your patch, which catches a surprising number of errors in patches. Either use the diff program (available in source code form from ftp://ftp.gnu.org/pub/gnu/), or use Johan Vromans' makepatch (available from CPAN/authors/id/JV/). Unified diffs are preferred, but context diffs are accepted. Do not send RCS-style diffs or diffs without context lines. More information is given in the Porting/patching.pod file in the Perl source distribution. Please patch against the latest development version (e.g., if you're fixing a bug in the 5.005 track, patch against the latest 5.005_5x version). Only patches that survive the heat of the development branch get applied to maintenance versions.
Your patch should update the documentation and test suite.
To report a bug in Perl, use the program perlbug which comes with Perl (if you can't get Perl to work, send mail to the address firstname.lastname@example.org or email@example.com). Reporting bugs through perlbug feeds into the automated bug-tracking system, access to which is provided through the web at http://bugs.perl.org/. It often pays to check the archives of the perl5-porters mailing list to see whether the bug you're reporting has been reported before, and if so whether it was considered a bug. See above for the location of the searchable archives.
The CPAN testers (http://testers.cpan.org/) are a group of volunteers who test CPAN modules on a variety of platforms. Perl Labs (http://labs.perl.org/) automatically tests Perl source releases on platforms and gives feedback to the CPAN testers mailing list. Both efforts welcome volunteers.
To become an active and patching Perl porter, you'll need to learn how
Perl works on the inside. Chip Salzenberg, a pumpking, has written
articles on Perl internals for The Perl Journal
(http://www.tpj.com/) which explain how various parts of the Perl
interpreter work. The
It is essential that you be comfortable using a good debugger (e.g. gdb, dbx) before you can patch perl. Stepping through perl as it executes a script is perhaps the best (if sometimes tedious) way to gain a precise understanding of the overall architecture of the language.
If you build a version of the Perl interpreter with
It's a good idea to read and lurk for a while before chipping in. That way you'll get to see the dynamic of the conversations, learn the personalities of the players, and hopefully be better prepared to make a useful contribution when do you speak up.
This document was written by Nathan Torkington, and is maintained by the perl5-porters mailing list.