4 Consistent formatting of this file is achieved with:
5 perl ./Porting/podtidy pod/perlhack.pod
9 perlhack - How to hack on Perl
13 This document explains how Perl development works. It includes details
14 about the Perl 5 Porters email list, the Perl repository, the Perlbug
15 bug tracker, patch guidelines, and commentary on Perl development
18 =head1 SUPER QUICK PATCH GUIDE
20 If you just want to submit a single small patch like a pod fix, a test
21 for a bug, comment fixes, etc., it's easy! Here's how:
25 =item * Check out the source repository
27 The perl source is in a git repository. You can clone the repository
28 with the following command:
30 % git clone git://perl5.git.perl.org/perl.git perl
32 =item * Ensure you're following the latest advice
34 In case the advice in this guide has been updated recently, read the
35 latest version directly from the perl source:
37 % perldoc pod/perlhack.pod
39 =item * Make your change
43 =item * Test your change
45 You can run all the tests with the following commands:
47 % ./Configure -des -Dusedevel
50 Keep hacking until the tests pass.
52 =item * Commit your change
54 Committing your work will save the change I<on your local system>:
56 % git commit -a -m 'Commit message goes here'
58 Make sure the commit message describes your change in a single
59 sentence. For example, "Fixed spelling errors in perlhack.pod".
61 =item * Send your change to perlbug
63 The next step is to submit your patch to the Perl core ticket system
66 Assuming your patch consists of a single git commit, the following
67 writes the file as a MIME attachment, and sends it with a meaningful
70 % git format-patch -1 --attach
71 % ./perl -Ilib utils/perlbug -s "[PATCH] $(
72 git log -1 --oneline HEAD)" -f 0001-*.patch
74 The perlbug program will ask you a few questions about your email
75 address and the patch you're submitting. Once you've answered them it
76 will submit your patch via email.
80 The porters appreciate the time you spent helping to make Perl better.
85 The next time you wish to make a patch, you need to start from the
86 latest perl in a pristine state. Check you don't have any local changes
87 or added files in your perl check-out which you wish to keep, then run
91 % git reset --hard origin/blead
98 If you want to report a bug in Perl, you must use the F<perlbug>
99 command line tool. This tool will ensure that your bug report includes
100 all the relevant system and configuration information.
102 To browse existing Perl bugs and patches, you can use the web interface
103 at L<http://rt.perl.org/>.
105 Please check the archive of the perl5-porters list (see below) and/or
106 the bug tracking system before submitting a bug report. Often, you'll
107 find that the bug has been reported already.
109 You can log in to the bug tracking system and comment on existing bug
110 reports. If you have additional information regarding an existing bug,
111 please add it. This will help the porters fix the bug.
113 =head1 PERL 5 PORTERS
115 The perl5-porters (p5p) mailing list is where the Perl standard
116 distribution is maintained and developed. The people who maintain Perl
117 are also referred to as the "Perl 5 Porters", "p5p" or just the
120 A searchable archive of the list is available at
121 L<http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/>. There is
122 also another archive at
123 L<http://archive.develooper.com/perl5-porters@perl.org/>.
125 =head2 perl-changes mailing list
127 The perl5-changes mailing list receives a copy of each patch that gets
128 submitted to the maintenance and development branches of the perl
129 repository. See L<http://lists.perl.org/list/perl5-changes.html> for
130 subscription and archive information.
134 Many porters are also active on the L<irc://irc.perl.org/#p5p> channel.
135 Feel free to join the channel and ask questions about hacking on the
138 =head1 GETTING THE PERL SOURCE
140 All of Perl's source code is kept centrally in a Git repository at
141 I<perl5.git.perl.org>. The repository contains many Perl revisions
142 from Perl 1 onwards and all the revisions from Perforce, the previous
143 version control system.
145 For much more detail on using git with the Perl repository, please see
148 =head2 Read access via Git
150 You will need a copy of Git for your computer. You can fetch a copy of
151 the repository using the git protocol:
153 % git clone git://perl5.git.perl.org/perl.git perl
155 This clones the repository and makes a local copy in the F<perl>
158 If you cannot use the git protocol for firewall reasons, you can also
159 clone via http, though this is much slower:
161 % git clone http://perl5.git.perl.org/perl.git perl
163 =head2 Read access via the web
165 You may access the repository over the web. This allows you to browse
166 the tree, see recent commits, subscribe to RSS feeds for the changes,
167 search for particular commits and more. You may access it at
168 L<http://perl5.git.perl.org/perl.git>. A mirror of the repository is
169 found at L<http://github.com/mirrors/perl>.
171 =head2 Read access via rsync
173 You can also choose to use rsync to get a copy of the current source
174 tree for the bleadperl branch and all maintenance branches:
176 % rsync -avz rsync://perl5.git.perl.org/perl-current .
177 % rsync -avz rsync://perl5.git.perl.org/perl-5.12.x .
178 % rsync -avz rsync://perl5.git.perl.org/perl-5.10.x .
179 % rsync -avz rsync://perl5.git.perl.org/perl-5.8.x .
180 % rsync -avz rsync://perl5.git.perl.org/perl-5.6.x .
181 % rsync -avz rsync://perl5.git.perl.org/perl-5.005xx .
183 (Add the C<--delete> option to remove leftover files.)
185 To get a full list of the available sync points:
187 % rsync perl5.git.perl.org::
189 =head2 Write access via git
191 If you have a commit bit, please see L<perlgit> for more details on
196 If you're planning to do more extensive work than a single small fix,
197 we encourage you to read the documentation below. This will help you
198 focus your work and make your patches easier to incorporate into the
201 =head2 Submitting patches
203 If you have a small patch to submit, please submit it via perlbug. You
204 can also send email directly to perlbug@perl.org. Please note that
205 messages sent to perlbug may be held in a moderation queue, so you
206 won't receive a response immediately.
208 You'll know your submission has been processed when you receive an
209 email from our ticket tracking system. This email will give you a
210 ticket number. Once your patch has made it to the ticket tracking
211 system, it will also be sent to the perl5-porters@perl.org list.
213 Patches are reviewed and discussed on the p5p list. Simple,
214 uncontroversial patches will usually be applied without any discussion.
215 When the patch is applied, the ticket will be updated and you will
216 receive email. In addition, an email will be sent to the p5p list.
218 In other cases, the patch will need more work or discussion. That will
219 happen on the p5p list.
221 You are encouraged to participate in the discussion and advocate for
222 your patch. Sometimes your patch may get lost in the shuffle. It's
223 appropriate to send a reminder email to p5p if no action has been taken
224 in a month. Please remember that the Perl 5 developers are all
225 volunteers, and be polite.
227 Changes are always applied directly to the main development branch,
228 called "blead". Some patches may be backported to a maintenance
229 branch. If you think your patch is appropriate for the maintenance
230 branch, please explain why when you submit it.
232 =head2 Getting your patch accepted
234 If you are submitting a code patch there are several things that you
235 can do to help the Perl 5 Porters accept your patch.
239 If you used git to check out the Perl source, then using C<git
240 format-patch> will produce a patch in a style suitable for Perl. The
241 C<format-patch> command produces one patch file for each commit you
242 made. If you prefer to send a single patch for all commits, you can
247 % git diff blead my-branch-name
249 This produces a patch based on the difference between blead and your
250 current branch. It's important to make sure that blead is up to date
251 before producing the diff, that's why we call C<git pull> first.
253 We strongly recommend that you use git if possible. It will make your
254 life easier, and ours as well.
256 However, if you're not using git, you can still produce a suitable
257 patch. You'll need a pristine copy of the Perl source to diff against.
258 The porters prefer unified diffs. Using GNU C<diff>, you can produce a
261 % diff -Npurd perl.pristine perl.mine
263 Make sure that you C<make realclean> in your copy of Perl to remove any
264 build artifacts, or you may get a confusing result.
266 =head3 Commit message
268 As you craft each patch you intend to submit to the Perl core, it's
269 important to write a good commit message. This is especially important
270 if your submission will consist of a series of commits.
272 The first line of the commit message should be a short description
273 without a period. It should be no longer than the subject line of an
274 email, 50 characters being a good rule of thumb.
276 A lot of Git tools (Gitweb, GitHub, git log --pretty=oneline, ...) will
277 only display the first line (cut off at 50 characters) when presenting
280 The commit message should include a description of the problem that the
281 patch corrects or new functionality that the patch adds.
283 As a general rule of thumb, your commit message should help a
284 programmer who knows the Perl core quickly understand what you were
285 trying to do, how you were trying to do it, and why the change matters
292 Your commit message should describe why the change you are making is
293 important. When someone looks at your change in six months or six
294 years, your intent should be clear.
296 If you're deprecating a feature with the intent of later simplifying
297 another bit of code, say so. If you're fixing a performance problem or
298 adding a new feature to support some other bit of the core, mention
303 Your commit message should describe what part of the Perl core you're
304 changing and what you expect your patch to do.
308 While it's not necessary for documentation changes, new tests or
309 trivial patches, it's often worth explaining how your change works.
310 Even if it's clear to you today, it may not be clear to a porter next
315 A commit message isn't intended to take the place of comments in your
316 code. Commit messages should describe the change you made, while code
317 comments should describe the current state of the code.
319 If you've just implemented a new feature, complete with doc, tests and
320 well-commented code, a brief commit message will often suffice. If,
321 however, you've just changed a single character deep in the parser or
322 lexer, you might need to write a small novel to ensure that future
323 readers understand what you did and why you did it.
325 =head3 Comments, Comments, Comments
327 Be sure to adequately comment your code. While commenting every line
328 is unnecessary, anything that takes advantage of side effects of
329 operators, that creates changes that will be felt outside of the
330 function being patched, or that others may find confusing should be
331 documented. If you are going to err, it is better to err on the side
332 of adding too many comments than too few.
334 The best comments explain I<why> the code does what it does, not I<what
339 In general, please follow the particular style of the code you are
342 In particular, follow these general guidelines for patching Perl
349 8-wide tabs (no exceptions!)
353 4-wide indents for code, 2-wide indents for nested CPP #defines
357 Try hard not to exceed 79-columns
365 Uncuddled elses and "K&R" style for indenting control constructs
369 No C++ style (//) comments
373 Mark places that need to be revisited with XXX (and revisit often!)
377 Opening brace lines up with "if" when conditional spans multiple lines;
378 should be at end-of-line otherwise
382 In function definitions, name starts in column 0 (return value is on
387 Single space after keywords that are followed by parens, no space
388 between function name and following paren
392 Avoid assignments in conditionals, but if they're unavoidable, use
393 extra paren, e.g. "if (a && (b = c)) ..."
397 "return foo;" rather than "return(foo);"
401 "if (!foo) ..." rather than "if (foo == FALSE) ..." etc.
405 Do not declare variables using "register". It may be counterproductive
406 with modern compilers, and is deprecated in C++, under which the Perl
407 source is regularly compiled.
411 In-line functions that are in headers that are accessible to XS code
412 need to be able to compile without warnings with commonly used extra
413 compilation flags, such as gcc's C<-Wswitch-default> which warns
414 whenever a switch statement does not have a "default" case. The use of
415 these extra flags is to catch potential problems in legal C code, and
416 is often used by Perl aggregators, such as Linux distributors.
422 If your patch changes code (rather than just changing documentation),
423 you should also include one or more test cases which illustrate the bug
424 you're fixing or validate the new functionality you're adding. In
425 general, you should update an existing test file rather than create a
428 Your test suite additions should generally follow these guidelines
429 (courtesy of Gurusamy Sarathy <gsar@activestate.com>):
435 Know what you're testing. Read the docs, and the source.
439 Tend to fail, not succeed.
443 Interpret results strictly.
447 Use unrelated features (this will flush out bizarre interactions).
451 Use non-standard idioms (otherwise you are not testing TIMTOWTDI).
455 Avoid using hardcoded test numbers whenever possible (the EXPECTED/GOT
456 found in t/op/tie.t is much more maintainable, and gives better failure
461 Give meaningful error messages when a test fails.
465 Avoid using qx// and system() unless you are testing for them. If you
466 do use them, make sure that you cover _all_ perl platforms.
470 Unlink any temporary files you create.
474 Promote unforeseen warnings to errors with $SIG{__WARN__}.
478 Be sure to use the libraries and modules shipped with the version being
479 tested, not those that were already installed.
483 Add comments to the code explaining what you are testing for.
487 Make updating the '1..42' string unnecessary. Or make sure that you
492 Test _all_ behaviors of a given operator, library, or function.
494 Test all optional arguments.
496 Test return values in various contexts (boolean, scalar, list, lvalue).
498 Use both global and lexical variables.
500 Don't forget the exceptional, pathological cases.
504 =head2 Patching a core module
506 This works just like patching anything else, with one extra
509 Modules in the F<cpan/> directory of the source tree are maintained
510 outside of the Perl core. When the author updates the module, the
511 updates are simply copied into the core. See that module's
512 documentation or its listing on L<http://search.cpan.org/> for more
513 information on reporting bugs and submitting patches.
515 In most cases, patches to modules in F<cpan/> should be sent upstream
516 and should not be applied to the Perl core individually. If a patch to
517 a file in F<cpan/> absolutely cannot wait for the fix to be made
518 upstream, released to CPAN and copied to blead, you must add (or
519 update) a C<CUSTOMIZED> entry in the F<"Porting/Maintainers.pl"> file
520 to flag that a local modification has been made. See
521 F<"Porting/Maintainers.pl"> for more details.
523 In contrast, modules in the F<dist/> directory are maintained in the
526 =head2 Updating perldelta
528 For changes significant enough to warrant a F<pod/perldelta.pod> entry,
529 the porters will greatly appreciate it if you submit a delta entry
530 along with your actual change. Significant changes include, but are
537 Adding, deprecating, or removing core features
541 Adding, deprecating, removing, or upgrading core or dual-life modules
545 Adding new core tests
549 Fixing security issues and user-visible bugs in the core
553 Changes that might break existing code, either on the perl or C level
557 Significant performance improvements
561 Adding, removing, or significantly changing documentation in the
566 Important platform-specific changes
570 Please make sure you add the perldelta entry to the right section
571 within F<pod/perldelta.pod>. More information on how to write good
572 perldelta entries is available in the C<Style> section of
573 F<Porting/how_to_write_a_perldelta.pod>.
575 =head2 What makes for a good patch?
577 New features and extensions to the language can be contentious. There
578 is no specific set of criteria which determine what features get added,
579 but here are some questions to consider when developing a patch:
581 =head3 Does the concept match the general goals of Perl?
583 Our goals include, but are not limited to:
589 Keep it fast, simple, and useful.
593 Keep features/concepts as orthogonal as possible.
597 No arbitrary limits (platforms, data sizes, cultures).
601 Keep it open and exciting to use/patch/advocate Perl everywhere.
605 Either assimilate new technologies, or build bridges to them.
609 =head3 Where is the implementation?
611 All the talk in the world is useless without an implementation. In
612 almost every case, the person or people who argue for a new feature
613 will be expected to be the ones who implement it. Porters capable of
614 coding new features have their own agendas, and are not available to
615 implement your (possibly good) idea.
617 =head3 Backwards compatibility
619 It's a cardinal sin to break existing Perl programs. New warnings can
620 be contentious--some say that a program that emits warnings is not
621 broken, while others say it is. Adding keywords has the potential to
622 break programs, changing the meaning of existing token sequences or
623 functions might break programs.
625 The Perl 5 core includes mechanisms to help porters make backwards
626 incompatible changes more compatible such as the L<feature> and
627 L<deprecate> modules. Please use them when appropriate.
629 =head3 Could it be a module instead?
631 Perl 5 has extension mechanisms, modules and XS, specifically to avoid
632 the need to keep changing the Perl interpreter. You can write modules
633 that export functions, you can give those functions prototypes so they
634 can be called like built-in functions, you can even write XS code to
635 mess with the runtime data structures of the Perl interpreter if you
636 want to implement really complicated things.
638 Whenever possible, new features should be prototyped in a CPAN module
639 before they will be considered for the core.
641 =head3 Is the feature generic enough?
643 Is this something that only the submitter wants added to the language,
644 or is it broadly useful? Sometimes, instead of adding a feature with a
645 tight focus, the porters might decide to wait until someone implements
646 the more generalized feature.
648 =head3 Does it potentially introduce new bugs?
650 Radical rewrites of large chunks of the Perl interpreter have the
651 potential to introduce new bugs.
653 =head3 How big is it?
655 The smaller and more localized the change, the better. Similarly, a
656 series of small patches is greatly preferred over a single large patch.
658 =head3 Does it preclude other desirable features?
660 A patch is likely to be rejected if it closes off future avenues of
661 development. For instance, a patch that placed a true and final
662 interpretation on prototypes is likely to be rejected because there are
663 still options for the future of prototypes that haven't been addressed.
665 =head3 Is the implementation robust?
667 Good patches (tight code, complete, correct) stand more chance of going
668 in. Sloppy or incorrect patches might be placed on the back burner
669 until the pumpking has time to fix, or might be discarded altogether
670 without further notice.
672 =head3 Is the implementation generic enough to be portable?
674 The worst patches make use of system-specific features. It's highly
675 unlikely that non-portable additions to the Perl language will be
678 =head3 Is the implementation tested?
680 Patches which change behaviour (fixing bugs or introducing new
681 features) must include regression tests to verify that everything works
684 Without tests provided by the original author, how can anyone else
685 changing perl in the future be sure that they haven't unwittingly
686 broken the behaviour the patch implements? And without tests, how can
687 the patch's author be confident that his/her hard work put into the
688 patch won't be accidentally thrown away by someone in the future?
690 =head3 Is there enough documentation?
692 Patches without documentation are probably ill-thought out or
693 incomplete. No features can be added or changed without documentation,
694 so submitting a patch for the appropriate pod docs as well as the
695 source code is important.
697 =head3 Is there another way to do it?
699 Larry said "Although the Perl Slogan is I<There's More Than One Way to
700 Do It>, I hesitate to make 10 ways to do something". This is a tricky
701 heuristic to navigate, though--one man's essential addition is another
702 man's pointless cruft.
704 =head3 Does it create too much work?
706 Work for the pumpking, work for Perl programmers, work for module
707 authors, ... Perl is supposed to be easy.
709 =head3 Patches speak louder than words
711 Working code is always preferred to pie-in-the-sky ideas. A patch to
712 add a feature stands a much higher chance of making it to the language
713 than does a random feature request, no matter how fervently argued the
714 request might be. This ties into "Will it be useful?", as the fact
715 that someone took the time to make the patch demonstrates a strong
716 desire for the feature.
720 The core uses the same testing style as the rest of Perl, a simple
721 "ok/not ok" run through Test::Harness, but there are a few special
724 There are three ways to write a test in the core: L<Test::More>,
725 F<t/test.pl> and ad hoc C<print $test ? "ok 42\n" : "not ok 42\n">.
726 The decision of which to use depends on what part of the test suite
727 you're working on. This is a measure to prevent a high-level failure
728 (such as Config.pm breaking) from causing basic functionality tests to
731 The F<t/test.pl> library provides some of the features of
732 L<Test::More>, but avoids loading most modules and uses as few core
733 features as possible.
735 If you write your own test, use the L<Test Anything
736 Protocol|http://testanything.org>.
740 =item * F<t/base>, F<t/comp> and F<t/opbasic>
742 Since we don't know if require works, or even subroutines, use ad hoc
743 tests for these three. Step carefully to avoid using the feature being
744 tested. Tests in F<t/opbasic>, for instance, have been placed there
745 rather than in F<t/op> because they test functionality which
746 F<t/test.pl> presumes has already been demonstrated to work.
748 =item * F<t/cmd>, F<t/run>, F<t/io> and F<t/op>
750 Now that basic require() and subroutines are tested, you can use the
751 F<t/test.pl> library.
753 You can also use certain libraries like Config conditionally, but be
754 sure to skip the test gracefully if it's not there.
756 =item * Everything else
758 Now that the core of Perl is tested, L<Test::More> can and should be
759 used. You can also use the full suite of core modules in the tests.
763 When you say "make test", Perl uses the F<t/TEST> program to run the
764 test suite (except under Win32 where it uses F<t/harness> instead).
765 All tests are run from the F<t/> directory, B<not> the directory which
766 contains the test. This causes some problems with the tests in
767 F<lib/>, so here's some opportunity for some patching.
769 You must be triply conscious of cross-platform concerns. This usually
770 boils down to using L<File::Spec> and avoiding things like C<fork()>
771 and C<system()> unless absolutely necessary.
773 =head2 Special C<make test> targets
775 There are various special make targets that can be used to test Perl
776 slightly differently than the standard "test" target. Not all them are
777 expected to give a 100% success rate. Many of them have several
778 aliases, and many of them are not available on certain operating
785 This runs some basic sanity tests on the source tree and helps catch
786 basic errors before you submit a patch.
790 Run F<miniperl> on F<t/base>, F<t/comp>, F<t/cmd>, F<t/run>, F<t/io>,
791 F<t/op>, F<t/uni> and F<t/mro> tests.
793 =item * test.valgrind check.valgrind
795 (Only in Linux) Run all the tests using the memory leak + naughty
796 memory access tool "valgrind". The log files will be named
797 F<testname.valgrind>.
801 Run the test suite with the F<t/harness> controlling program, instead
802 of F<t/TEST>. F<t/harness> is more sophisticated, and uses the
803 L<Test::Harness> module, thus using this test target supposes that perl
804 mostly works. The main advantage for our purposes is that it prints a
805 detailed summary of failed tests at the end. Also, unlike F<t/TEST>,
806 it doesn't redirect stderr to stdout.
808 Note that under Win32 F<t/harness> is always used instead of F<t/TEST>,
809 so there is no special "test_harness" target.
811 Under Win32's "test" target you may use the TEST_SWITCHES and
812 TEST_FILES environment variables to control the behaviour of
813 F<t/harness>. This means you can say
815 nmake test TEST_FILES="op/*.t"
816 nmake test TEST_SWITCHES="-torture" TEST_FILES="op/*.t"
818 =item * test-notty test_notty
820 Sets PERL_SKIP_TTY_TEST to true before running normal test.
824 =head2 Parallel tests
826 The core distribution can now run its regression tests in parallel on
827 Unix-like platforms. Instead of running C<make test>, set C<TEST_JOBS>
828 in your environment to the number of tests to run in parallel, and run
829 C<make test_harness>. On a Bourne-like shell, this can be done as
831 TEST_JOBS=3 make test_harness # Run 3 tests in parallel
833 An environment variable is used, rather than parallel make itself,
834 because L<TAP::Harness> needs to be able to schedule individual
835 non-conflicting test scripts itself, and there is no standard interface
836 to C<make> utilities to interact with their job schedulers.
838 Note that currently some test scripts may fail when run in parallel
839 (most notably F<ext/IO/t/io_dir.t>). If necessary, run just the
840 failing scripts again sequentially and see if the failures go away.
842 =head2 Running tests by hand
844 You can run part of the test suite by hand by using one of the
845 following commands from the F<t/> directory:
847 ./perl -I../lib TEST list-of-.t-files
851 ./perl -I../lib harness list-of-.t-files
853 (If you don't specify test scripts, the whole test suite will be run.)
855 =head2 Using F<t/harness> for testing
857 If you use C<harness> for testing, you have several command line
858 options available to you. The arguments are as follows, and are in the
859 order that they must appear if used together.
861 harness -v -torture -re=pattern LIST OF FILES TO TEST
862 harness -v -torture -re LIST OF PATTERNS TO MATCH
864 If C<LIST OF FILES TO TEST> is omitted, the file list is obtained from
865 the manifest. The file list may include shell wildcards which will be
872 Run the tests under verbose mode so you can see what tests were run,
877 Run the torture tests as well as the normal set.
881 Filter the file list so that all the test files run match PATTERN.
882 Note that this form is distinct from the B<-re LIST OF PATTERNS> form
883 below in that it allows the file list to be provided as well.
885 =item * -re LIST OF PATTERNS
887 Filter the file list so that all the test files run match
888 /(LIST|OF|PATTERNS)/. Note that with this form the patterns are joined
889 by '|' and you cannot supply a list of files, instead the test files
890 are obtained from the MANIFEST.
894 You can run an individual test by a command similar to
896 ./perl -I../lib path/to/foo.t
898 except that the harnesses set up some environment variables that may
899 affect the execution of the test:
905 indicates that we're running this test as part of the perl core test
906 suite. This is useful for modules that have a dual life on CPAN.
908 =item * PERL_DESTRUCT_LEVEL=2
910 is set to 2 if it isn't set already (see
911 L<perlhacktips/PERL_DESTRUCT_LEVEL>).
915 (used only by F<t/TEST>) if set, overrides the path to the perl
916 executable that should be used to run the tests (the default being
919 =item * PERL_SKIP_TTY_TEST
921 if set, tells to skip the tests that need a terminal. It's actually
922 set automatically by the Makefile, but can also be forced artificially
923 by running 'make test_notty'.
927 =head3 Other environment variables that may influence tests
931 =item * PERL_TEST_Net_Ping
933 Setting this variable runs all the Net::Ping modules tests, otherwise
934 some tests that interact with the outside world are skipped. See
937 =item * PERL_TEST_NOVREXX
939 Setting this variable skips the vrexx.t tests for OS2::REXX.
941 =item * PERL_TEST_NUMCONVERTS
943 This sets a variable in op/numconvert.t.
945 =item * PERL_TEST_MEMORY
947 Setting this variable includes the tests in F<t/bigmem/>. This should
948 be set to the number of gigabytes of memory available for testing, eg.
949 C<PERL_TEST_MEMORY=4> indicates that tests that require 4GiB of
950 available memory can be run safely.
954 See also the documentation for the Test and Test::Harness modules, for
955 more environment variables that affect testing.
957 =head1 MORE READING FOR GUTS HACKERS
959 To hack on the Perl guts, you'll need to read the following things:
963 =item * L<perlsource>
965 An overview of the Perl source tree. This will help you find the files
968 =item * L<perlinterp>
970 An overview of the Perl interpreter source code and some details on how
971 Perl does what it does.
973 =item * L<perlhacktut>
975 This document walks through the creation of a small patch to Perl's C
976 code. If you're just getting started with Perl core hacking, this will
977 help you understand how it works.
979 =item * L<perlhacktips>
981 More details on hacking the Perl core. This document focuses on lower
982 level details such as how to write tests, compilation issues,
983 portability, debugging, etc.
985 If you plan on doing serious C hacking, make sure to read this.
989 This is of paramount importance, since it's the documentation of what
990 goes where in the Perl source. Read it over a couple of times and it
991 might start to make sense - don't worry if it doesn't yet, because the
992 best way to study it is to read it in conjunction with poking at Perl
993 source, and we'll do that later on.
995 Gisle Aas's "illustrated perlguts", also known as I<illguts>, has very
998 L<http://search.cpan.org/dist/illguts/>
1000 =item * L<perlxstut> and L<perlxs>
1002 A working knowledge of XSUB programming is incredibly useful for core
1003 hacking; XSUBs use techniques drawn from the PP code, the portion of
1004 the guts that actually executes a Perl program. It's a lot gentler to
1005 learn those techniques from simple examples and explanation than from
1010 The documentation for the Perl API explains what some of the internal
1011 functions do, as well as the many macros used in the source.
1013 =item * F<Porting/pumpkin.pod>
1015 This is a collection of words of wisdom for a Perl porter; some of it
1016 is only useful to the pumpkin holder, but most of it applies to anyone
1017 wanting to go about Perl development.
1021 =head1 CPAN TESTERS AND PERL SMOKERS
1023 The CPAN testers ( http://testers.cpan.org/ ) are a group of volunteers
1024 who test CPAN modules on a variety of platforms.
1026 Perl Smokers ( http://www.nntp.perl.org/group/perl.daily-build/ and
1027 http://www.nntp.perl.org/group/perl.daily-build.reports/ )
1028 automatically test Perl source releases on platforms with various
1031 Both efforts welcome volunteers. In order to get involved in smoke
1032 testing of the perl itself visit
1033 L<http://search.cpan.org/dist/Test-Smoke/>. In order to start smoke
1034 testing CPAN modules visit
1035 L<http://search.cpan.org/dist/CPANPLUS-YACSmoke/> or
1036 L<http://search.cpan.org/dist/minismokebox/> or
1037 L<http://search.cpan.org/dist/CPAN-Reporter/>.
1041 If you've read all the documentation in the document and the ones
1042 listed above, you're more than ready to hack on Perl.
1044 Here's some more recommendations
1050 Subscribe to perl5-porters, follow the patches and try and understand
1051 them; don't be afraid to ask if there's a portion you're not clear on -
1052 who knows, you may unearth a bug in the patch...
1056 Do read the README associated with your operating system, e.g.
1057 README.aix on the IBM AIX OS. Don't hesitate to supply patches to that
1058 README if you find anything missing or changed over a new OS release.
1062 Find an area of Perl that seems interesting to you, and see if you can
1063 work out how it works. Scan through the source, and step over it in
1064 the debugger. Play, poke, investigate, fiddle! You'll probably get to
1065 understand not just your chosen area but a much wider range of
1066 F<perl>'s activity as well, and probably sooner than you'd think.
1070 =head2 "The Road goes ever on and on, down from the door where it began."
1072 If you can do these things, you've started on the long road to Perl
1073 porting. Thanks for wanting to help make Perl better - and happy
1076 =head2 Metaphoric Quotations
1078 If you recognized the quote about the Road above, you're in luck.
1080 Most software projects begin each file with a literal description of
1081 each file's purpose. Perl instead begins each with a literary allusion
1082 to that file's purpose.
1084 Like chapters in many books, all top-level Perl source files (along
1085 with a few others here and there) begin with an epigrammatic
1086 inscription that alludes, indirectly and metaphorically, to the
1087 material you're about to read.
1089 Quotations are taken from writings of J.R.R. Tolkien pertaining to his
1090 Legendarium, almost always from I<The Lord of the Rings>. Chapters and
1091 page numbers are given using the following editions:
1097 I<The Hobbit>, by J.R.R. Tolkien. The hardcover, 70th-anniversary
1098 edition of 2007 was used, published in the UK by Harper Collins
1099 Publishers and in the US by the Houghton Mifflin Company.
1103 I<The Lord of the Rings>, by J.R.R. Tolkien. The hardcover,
1104 50th-anniversary edition of 2004 was used, published in the UK by
1105 Harper Collins Publishers and in the US by the Houghton Mifflin
1110 I<The Lays of Beleriand>, by J.R.R. Tolkien and published posthumously
1111 by his son and literary executor, C.J.R. Tolkien, being the 3rd of the
1112 12 volumes in Christopher's mammoth I<History of Middle Earth>. Page
1113 numbers derive from the hardcover edition, first published in 1983 by
1114 George Allen & Unwin; no page numbers changed for the special 3-volume
1115 omnibus edition of 2002 or the various trade-paper editions, all again
1116 now by Harper Collins or Houghton Mifflin.
1120 Other JRRT books fair game for quotes would thus include I<The
1121 Adventures of Tom Bombadil>, I<The Silmarillion>, I<Unfinished Tales>,
1122 and I<The Tale of the Children of Hurin>, all but the first
1123 posthumously assembled by CJRT. But I<The Lord of the Rings> itself is
1124 perfectly fine and probably best to quote from, provided you can find a
1125 suitable quote there.
1127 So if you were to supply a new, complete, top-level source file to add
1128 to Perl, you should conform to this peculiar practice by yourself
1129 selecting an appropriate quotation from Tolkien, retaining the original
1130 spelling and punctuation and using the same format the rest of the
1131 quotes are in. Indirect and oblique is just fine; remember, it's a
1132 metaphor, so being meta is, after all, what it's for.
1136 This document was originally written by Nathan Torkington, and is
1137 maintained by the perl5-porters mailing list.