This document explains how Perl development works. It includes details
       about the Perl 5 Porters email list, the Perl repository, the Perlbug
       bug tracker, patch guidelines, and commentary on Perl development

       If you just want to submit a single small patch like a pod fix, a test
       for a bug, comment fixes, etc., it's easy! Here's how:

       o   Check out the source repository

           The perl source is in a git repository. You can clone the
           repository with the following command:

             % git clone git:// perl

       o   Make your change

           Hack, hack, hack.

       o   Test your change

           You can run all the tests with the following commands:

             % ./Configure -des -Dusedevel
             % make test

           Keep hacking until the tests pass.

       o   Commit your change

           Committing your work will save the change on your local system:

             % git commit -a -m 'Commit message goes here'

           Make sure the commit message describes your change in a single
           sentence. For example, "Fixed spelling errors in perlhack.pod".

       o   Send your change to perlbug

           The next step is to submit your patch to the Perl core ticket
           system via email.

           Assuming your patch consists of a single git commit, you can send
           it to perlbug with this command line:

             % git format-patch HEAD^1..HEAD
             % perlbug -s '[PATCH] `git log --pretty=format:%s HEAD^1..HEAD`' -f 0001-*.patch

           The perlbug program will ask you a few questions about your email
           address and the patch you're submitting. Once you've answered them
           you can submit your patch.

       at <>.

       Please check the archive of the perl5-porters list (see below) and/or
       the bug tracking system before submitting a bug report. Often, you'll
       find that the bug has been reported already.

       You can log in to the bug tracking system and comment on existing bug
       reports. If you have additional information regarding an existing bug,
       please add it. This will help the porters fix the bug.

       The perl5-porters (p5p) mailing list is where the Perl standard
       distribution is maintained and developed. The people who maintain Perl
       are also referred to as the "Perl 5 Porters", or just the "porters".

       A searchable archive of the list is available at
       <>. There is
       also another archive at

   perl-changes mailing list
       The perl5-changes mailing list receives a copy of each patch that gets
       submitted to the maintenance and development branches of the perl
       repository. See
       <> for subscription and
       archive information.

       All of Perl's source code is kept centrally in a Git repository at The repository contains many Perl revisions from
       Perl 1 onwards and all the revisions from Perforce, the previous
       version control system.

       For much more detail on using git with the Perl repository, please see

   Read access via Git
       You will need a copy of Git for your computer. You can fetch a copy of
       the repository using the git protocol:

         % git clone git:// perl

       This clones the repository and makes a local copy in the perl

       If you cannot use the git protocol for firewall reasons, you can also
       clone via http, though this is much slower:

         % git clone perl

   Read access via the web
       You may access the repository over the web. This allows you to browse
           % rsync -avz rsync:// .
           % rsync -avz rsync:// .
           % rsync -avz rsync:// .

       (Add the "--delete" option to remove leftover files.)

       To get a full list of the available sync points:

           % rsync

   Write access via git
       If you have a commit bit, please see perlgit for more details on using

       If you're planning to do more extensive work than a single small fix,
       we encourage you to read the documentation below. This will help you
       focus your work and make your patches easier to incorporate into the
       Perl source.

   Submitting patches
       If you have a small patch to submit, please submit it via perlbug. You
       can also send email directly to Please note that
       messages sent to perlbug may be held in a moderation queue, so you
       won't receive a response immediately.

       You'll know your submission has been processed when you receive an
       email from our ticket tracking system. This email will give you a
       ticket number. Once your patch has made it to the ticket tracking
       system, it will also be sent to the list.

       Patches are reviewed and discussed on the p5p list. Simple,
       uncontroversial patches will usually be applied without any discussion.
       When the patch is applied, the ticket will be updated and you will
       receive email. In addition, an email will be sent to the p5p list.

       In other cases, the patch will need more work or discussion. That will
       happen on the p5p list.

       You are encouraged to participate in the discussion and advocate for
       your patch. Sometimes your patch may get lost in the shuffle. It's
       appropriate to send a reminder email to p5p if no action has been taken
       in a month. Please remember that the Perl 5 developers are all
       volunteers, and be polite.

       Changes are always applied directly to the main development branch,
       called "blead". Some patches may be backported to a maintenance branch.
       If you think your patch is appropriate for the maintenance branch,
       please explain why when you submit it.

   Getting your patch accepted
       If you are submitting a code patch there are several things that you
       can do to help the Perl 5 Porters accept your patch.

       This produces a patch based on the difference between blead and your
       current branch. It's important to make sure that blead is up to date
       before producing the diff, that's why we call "git pull" first.

       We strongly recommend that you use git if possible. It will make your
       life easier, and ours as well.

       However, if you're not using git, you can still produce a suitable
       patch. You'll need a pristine copy of the Perl source to diff against.
       The porters prefer unified diffs. Using GNU "diff", you can produce a
       diff like this:

         % diff -Npurd perl.pristine perl.mine

       Make sure that you "make realclean" in your copy of Perl to remove any
       build artifacts, or you may get a confusing result.

       Commit message

       As you craft each patch you intend to submit to the Perl core, it's
       important to write a good commit message. This is especially important
       if your submission will consist of a series of commits.

       The first line of the commit message should be a short description
       without a period. It should be no longer than the subject line of an
       email, 50 characters being a good rule of thumb.

       A lot of Git tools (Gitweb, GitHub, git log --pretty=oneline, ...) will
       only display the first line (cut off at 50 characters) when presenting
       commit summaries.

       The commit message should include a description of the problem that the
       patch corrects or new functionality that the patch adds.

       As a general rule of thumb, your commit message should help a
       programmer who knows the Perl core quickly understand what you were
       trying to do, how you were trying to do it, and why the change matters
       to Perl.

       o   Why

           Your commit message should describe why the change you are making
           is important. When someone looks at your change in six months or
           six years, your intent should be clear.

           If you're deprecating a feature with the intent of later
           simplifying another bit of code, say so. If you're fixing a
           performance problem or adding a new feature to support some other
           bit of the core, mention that.

       o   What

           Your commit message should describe what part of the Perl core
           you're changing and what you expect your patch to do.

       If you've just implemented a new feature, complete with doc, tests and
       well-commented code, a brief commit message will often suffice. If,
       however, you've just changed a single character deep in the parser or
       lexer, you might need to write a small novel to ensure that future
       readers understand what you did and why you did it.

       Comments, Comments, Comments

       Be sure to adequately comment your code. While commenting every line is
       unnecessary, anything that takes advantage of side effects of
       operators, that creates changes that will be felt outside of the
       function being patched, or that others may find confusing should be
       documented. If you are going to err, it is better to err on the side of
       adding too many comments than too few.

       The best comments explain why the code does what it does, not what it


       In general, please follow the particular style of the code you are

       In particular, follow these general guidelines for patching Perl

       o   8-wide tabs (no exceptions!)

       o   4-wide indents for code, 2-wide indents for nested CPP #defines

       o   Try hard not to exceed 79-columns

       o   ANSI C prototypes

       o   Uncuddled elses and "K&R" style for indenting control constructs

       o   No C++ style (//) comments

       o   Mark places that need to be revisited with XXX (and revisit often!)

       o   Opening brace lines up with "if" when conditional spans multiple
           lines; should be at end-of-line otherwise

       o   In function definitions, name starts in column 0 (return value is
           on previous line)

       o   Single space after keywords that are followed by parens, no space
           between function name and following paren

       o   Avoid assignments in conditionals, but if they're unavoidable, use
           extra paren, e.g. "if (a && (b = c)) ..."

       o   "return foo;" rather than "return(foo);"

       o   Know what you're testing. Read the docs, and the source.

       o   Tend to fail, not succeed.

       o   Interpret results strictly.

       o   Use unrelated features (this will flush out bizarre interactions).

       o   Use non-standard idioms (otherwise you are not testing TIMTOWTDI).

       o   Avoid using hardcoded test numbers whenever possible (the
           EXPECTED/GOT found in t/op/tie.t is much more maintainable, and
           gives better failure reports).

       o   Give meaningful error messages when a test fails.

       o   Avoid using qx// and system() unless you are testing for them. If
           you do use them, make sure that you cover _all_ perl platforms.

       o   Unlink any temporary files you create.

       o   Promote unforeseen warnings to errors with $SIG{__WARN__}.

       o   Be sure to use the libraries and modules shipped with the version
           being tested, not those that were already installed.

       o   Add comments to the code explaining what you are testing for.

       o   Make updating the '1..42' string unnecessary. Or make sure that you
           update it.

       o   Test _all_ behaviors of a given operator, library, or function.

           Test all optional arguments.

           Test return values in various contexts (boolean, scalar, list,

           Use both global and lexical variables.

           Don't forget the exceptional, pathological cases.

   Patching a core module
       This works just like patching anything else, with one extra

       Some core modules also live on CPAN and are maintained outside of the
       Perl core. When the author updates the module, the updates are simply
       copied into the core.

       Modules in the cpan/ directory of the source tree are maintained
       outside of the Perl core. See that module's listing on documentation or
       its listing on <> for more information on
       o   Adding, deprecating, removing, or upgrading core or dual-life

       o   Adding new core tests

       o   Fixing security issues and user-visible bugs in the core

       o   Changes that might break existing code, either on the perl or C

       o   Significant performance improvements

       o   Adding, removing, or significantly changing documentation in the
           pod/ directory

       o   Important platform-specific changes

       Please make sure you add the perldelta entry to the right section
       within pod/perldelta.pod. More information on how to write good
       perldelta entries is available in the "Style" section of

   What makes for a good patch?
       New features and extensions to the language can be contentious. There
       is no specific set of criteria which determine what features get added,
       but here are some questions to consider when developing a patch:

       Does the concept match the general goals of Perl?

       Our goals include, but are not limited to:

       1.  Keep it fast, simple, and useful.

       2.  Keep features/concepts as orthogonal as possible.

       3.  No arbitrary limits (platforms, data sizes, cultures).

       4.  Keep it open and exciting to use/patch/advocate Perl everywhere.

       5.  Either assimilate new technologies, or build bridges to them.

       Where is the implementation?

       All the talk in the world is useless without an implementation. In
       almost every case, the person or people who argue for a new feature
       will be expected to be the ones who implement it. Porters capable of
       coding new features have their own agendas, and are not available to
       implement your (possibly good) idea.

       Backwards compatibility

       It's a cardinal sin to break existing Perl programs. New warnings can
       be contentious--some say that a program that emits warnings is not
       broken, while others say it is. Adding keywords has the potential to
       can be called like built-in functions, you can even write XS code to
       mess with the runtime data structures of the Perl interpreter if you
       want to implement really complicated things.

       Whenever possible, new features should be prototyped in a CPAN module
       before they will be considered for the core.

       Is the feature generic enough?

       Is this something that only the submitter wants added to the language,
       or is it broadly useful?  Sometimes, instead of adding a feature with a
       tight focus, the porters might decide to wait until someone implements
       the more generalized feature.

       Does it potentially introduce new bugs?

       Radical rewrites of large chunks of the Perl interpreter have the
       potential to introduce new bugs.

       How big is it?

       The smaller and more localized the change, the better. Similarly, a
       series of small patches is greatly preferred over a single large patch.

       Does it preclude other desirable features?

       A patch is likely to be rejected if it closes off future avenues of
       development. For instance, a patch that placed a true and final
       interpretation on prototypes is likely to be rejected because there are
       still options for the future of prototypes that haven't been addressed.

       Is the implementation robust?

       Good patches (tight code, complete, correct) stand more chance of going
       in. Sloppy or incorrect patches might be placed on the back burner
       until the pumpking has time to fix, or might be discarded altogether
       without further notice.

       Is the implementation generic enough to be portable?

       The worst patches make use of system-specific features. It's highly
       unlikely that non-portable additions to the Perl language will be

       Is the implementation tested?

       Patches which change behaviour (fixing bugs or introducing new
       features) must include regression tests to verify that everything works
       as expected.

       Without tests provided by the original author, how can anyone else
       changing perl in the future be sure that they haven't unwittingly
       broken the behaviour the patch implements? And without tests, how can
       the patch's author be confident that his/her hard work put into the
       It, I hesitate to make 10 ways to do something". This is a tricky
       heuristic to navigate, though--one man's essential addition is another
       man's pointless cruft.

       Does it create too much work?

       Work for the pumpking, work for Perl programmers, work for module
       authors, ... Perl is supposed to be easy.

       Patches speak louder than words

       Working code is always preferred to pie-in-the-sky ideas. A patch to
       add a feature stands a much higher chance of making it to the language
       than does a random feature request, no matter how fervently argued the
       request might be. This ties into "Will it be useful?", as the fact that
       someone took the time to make the patch demonstrates a strong desire
       for the feature.

       The core uses the same testing style as the rest of Perl, a simple
       "ok/not ok" run through Test::Harness, but there are a few special

       There are three ways to write a test in the core. Test::More, t/
       and ad hoc "print $test ? "ok 42\n" : "not ok 42\n"". The decision of
       which to use depends on what part of the test suite you're working on.
       This is a measure to prevent a high-level failure (such as
       breaking) from causing basic functionality tests to fail.

       The t/ library provides some of the features of Test::More, but
       avoids loading most modules and uses as few core features as possible.

       If you write your own test, use the Test Anything Protocol.

       o   t/base and t/comp

           Since we don't know if require works, or even subroutines, use ad
           hoc tests for these two. Step carefully to avoid using the feature
           being tested.

       o   t/cmd, t/run, t/io and t/op

           Now that basic require() and subroutines are tested, you can use
           the t/ library.

           You can also use certain libraries like Config conditionally, but
           be sure to skip the test gracefully if it's not there.

       o   Everything else

           Now that the core of Perl is tested, Test::More can and should be
           used. You can also use the full suite of core modules in the tests.

       When you say "make test", Perl uses the t/TEST program to run the test
       expected to give a 100% success rate. Many of them have several
       aliases, and many of them are not available on certain operating

       o   test_porting

           This runs some basic sanity tests on the source tree and helps
           catch basic errors before you submit a patch.

       o   coretest

           Run perl on all core tests (t/* and lib/[a-z]* pragma tests).

           (Not available on Win32)

       o   test.deparse

           Run all the tests through B::Deparse. Not all tests will succeed.

           (Not available on Win32)

       o   test.taintwarn

           Run all tests with the -t command-line switch. Not all tests are
           expected to succeed (until they're specifically fixed, of course).

           (Not available on Win32)

       o   minitest

           Run miniperl on t/base, t/comp, t/cmd, t/run, t/io, t/op, t/uni and
           t/mro tests.

       o   test.valgrind check.valgrind utest.valgrind ucheck.valgrind

           (Only in Linux) Run all the tests using the memory leak + naughty
           memory access tool "valgrind". The log files will be named

       o   test.torture torturetest

           Run all the usual tests and some extra tests. As of Perl 5.8.0, the
           only extra tests are Abigail's JAPHs, t/japh/abigail.t.

           You can also run the torture test with t/harness by giving
           "-torture" argument to t/harness.

       o   utest ucheck test.utf8 check.utf8

           Run all the tests with -Mutf8. Not all tests will succeed.

           (Not available on Win32)

       o   minitest.utf16 test.utf16
           of t/TEST. t/harness is more sophisticated, and uses the
           Test::Harness module, thus using this test target supposes that
           perl mostly works. The main advantage for our purposes is that it
           prints a detailed summary of failed tests at the end. Also, unlike
           t/TEST, it doesn't redirect stderr to stdout.

           Note that under Win32 t/harness is always used instead of t/TEST,
           so there is no special "test_harness" target.

           Under Win32's "test" target you may use the TEST_SWITCHES and
           TEST_FILES environment variables to control the behaviour of
           t/harness. This means you can say

               nmake test TEST_FILES="op/*.t"
               nmake test TEST_SWITCHES="-torture" TEST_FILES="op/*.t"

       o   test-notty test_notty

           Sets PERL_SKIP_TTY_TEST to true before running normal test.

   Parallel tests
       The core distribution can now run its regression tests in parallel on
       Unix-like platforms. Instead of running "make test", set "TEST_JOBS" in
       your environment to the number of tests to run in parallel, and run
       "make test_harness". On a Bourne-like shell, this can be done as

           TEST_JOBS=3 make test_harness  # Run 3 tests in parallel

       An environment variable is used, rather than parallel make itself,
       because TAP::Harness needs to be able to schedule individual non-
       conflicting test scripts itself, and there is no standard interface to
       "make" utilities to interact with their job schedulers.

       Note that currently some test scripts may fail when run in parallel
       (most notably "ext/IO/t/io_dir.t"). If necessary, run just the failing
       scripts again sequentially and see if the failures go away.

   Running tests by hand
       You can run part of the test suite by hand by using one of the
       following commands from the t/ directory:

           ./perl -I../lib TEST list-of-.t-files


           ./perl -I../lib harness list-of-.t-files

       (If you don't specify test scripts, the whole test suite will be run.)

   Using t/harness for testing
       If you use "harness" for testing, you have several command line options
       available to you. The arguments are as follows, and are in the order
       that they must appear if used together.

       o   -torture

           Run the torture tests as well as the normal set.

       o   -re=PATTERN

           Filter the file list so that all the test files run match PATTERN.
           Note that this form is distinct from the -re LIST OF PATTERNS form
           below in that it allows the file list to be provided as well.

       o   -re LIST OF PATTERNS

           Filter the file list so that all the test files run match
           /(LIST|OF|PATTERNS)/. Note that with this form the patterns are
           joined by '|' and you cannot supply a list of files, instead the
           test files are obtained from the MANIFEST.

       You can run an individual test by a command similar to

           ./perl -I../lib path/to/foo.t

       except that the harnesses set up some environment variables that may
       affect the execution of the test:

       o   PERL_CORE=1

           indicates that we're running this test as part of the perl core
           test suite. This is useful for modules that have a dual life on


           is set to 2 if it isn't set already (see "PERL_DESTRUCT_LEVEL" in

       o   PERL

           (used only by t/TEST) if set, overrides the path to the perl
           executable that should be used to run the tests (the default being


           if set, tells to skip the tests that need a terminal. It's actually
           set automatically by the Makefile, but can also be forced
           artificially by running 'make test_notty'.

       Other environment variables that may influence tests

       o   PERL_TEST_Net_Ping

           Setting this variable runs all the Net::Ping modules tests,
           otherwise some tests that interact with the outside world are
           skipped. See perl58delta.

       To hack on the Perl guts, you'll need to read the following things:

       o   perlsource

           An overview of the Perl source tree. This will help you find the
           files you're looking for.

       o   perlinterp

           An overview of the Perl interpreter source code and some details on
           how Perl does what it does.

       o   perlhacktut

           This document walks through the creation of a small patch to Perl's
           C code. If you're just getting started with Perl core hacking, this
           will help you understand how it works.

       o   perlhacktips

           More details on hacking the Perl core. This document focuses on
           lower level details such as how to write tests, compilation issues,
           portability, debugging, etc.

           If you plan on doing serious C hacking, make sure to read this.

       o   perlguts

           This is of paramount importance, since it's the documentation of
           what goes where in the Perl source. Read it over a couple of times
           and it might start to make sense - don't worry if it doesn't yet,
           because the best way to study it is to read it in conjunction with
           poking at Perl source, and we'll do that later on.

           Gisle Aas's "illustrated perlguts", also known as illguts, has very
           helpful pictures:


       o   perlxstut and perlxs

           A working knowledge of XSUB programming is incredibly useful for
           core hacking; XSUBs use techniques drawn from the PP code, the
           portion of the guts that actually executes a Perl program. It's a
           lot gentler to learn those techniques from simple examples and
           explanation than from the core itself.

       o   perlapi

           The documentation for the Perl API explains what some of the
           internal functions do, as well as the many macros used in the

       The CPAN testers ( ) are a group of volunteers
       who test CPAN modules on a variety of platforms.

       Perl Smokers ( and )
       automatically test Perl source releases on platforms with various

       Both efforts welcome volunteers. In order to get involved in smoke
       testing of the perl itself visit
       <>. In order to start smoke
       testing CPAN modules visit
       <> or
       <> or

       If you've read all the documentation in the document and the ones
       listed above, you're more than ready to hack on Perl.

       Here's some more recommendations

       o   Subscribe to perl5-porters, follow the patches and try and
           understand them; don't be afraid to ask if there's a portion you're
           not clear on - who knows, you may unearth a bug in the patch...

       o   Do read the README associated with your operating system, e.g.
           README.aix on the IBM AIX OS. Don't hesitate to supply patches to
           that README if you find anything missing or changed over a new OS

       o   Find an area of Perl that seems interesting to you, and see if you
           can work out how it works. Scan through the source, and step over
           it in the debugger. Play, poke, investigate, fiddle! You'll
           probably get to understand not just your chosen area but a much
           wider range of perl's activity as well, and probably sooner than
           you'd think.

   "The Road goes ever on and on, down from the door where it began."
       If you can do these things, you've started on the long road to Perl
       porting. Thanks for wanting to help make Perl better - and happy

   Metaphoric Quotations
       If you recognized the quote about the Road above, you're in luck.

       Most software projects begin each file with a literal description of
       each file's purpose. Perl instead begins each with a literary allusion
       to that file's purpose.
           Publishers and in the US by the Houghton Mifflin Company.

       o   The Lord of the Rings, by J.R.R. Tolkien. The hardcover,
           50th-anniversary edition of 2004 was used, published in the UK by
           Harper Collins Publishers and in the US by the Houghton Mifflin

       o   The Lays of Beleriand, by J.R.R. Tolkien and published posthumously
           by his son and literary executor, C.J.R. Tolkien, being the 3rd of
           the 12 volumes in Christopher's mammoth History of Middle Earth.
           Page numbers derive from the hardcover edition, first published in
           1983 by George Allen & Unwin; no page numbers changed for the
           special 3-volume omnibus edition of 2002 or the various trade-paper
           editions, all again now by Harper Collins or Houghton Mifflin.

       Other JRRT books fair game for quotes would thus include The Adventures
       of Tom Bombadil, The Silmarillion, Unfinished Tales, and The Tale of
       the Children of Hurin, all but the first posthumously assembled by
       CJRT. But The Lord of the Rings itself is perfectly fine and probably
       best to quote from, provided you can find a suitable quote there.

       So if you were to supply a new, complete, top-level source file to add
       to Perl, you should conform to this peculiar practice by yourself
       selecting an appropriate quotation from Tolkien, retaining the original
       spelling and punctuation and using the same format the rest of the
       quotes are in. Indirect and oblique is just fine; remember, it's a
       metaphor, so being meta is, after all, what it's for.

       This document was originally written by Nathan Torkington, and is
       maintained by the perl5-porters mailing list.

perl v5.14.2                      2011-09-26                       PERLHACK(1)
Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2017 Hurricane Electric. All Rights Reserved.