4 Consistent formatting of this file is achieved with:
5 perl ./Porting/podtidy pod/perlsource.pod
9 perlsource - A guide to the Perl source tree
13 This document describes the layout of the Perl source tree. If you're
14 hacking on the Perl core, this will help you find what you're looking
17 =head1 FINDING YOUR WAY AROUND
19 The Perl source tree is big. Here's some of the thing you'll find in
24 The C source code and header files mostly live in the root of the
25 source tree. There are a few platform-specific directories which
26 contain C code. In addition, some of the modules shipped with Perl
29 See L<perlinterp> for more details on the files that make up the Perl
30 interpreter, as well as details on how it works.
34 Modules shipped as part of the Perl core live in four subdirectories.
35 Two of these directories contain modules that live in the core, and two
36 contain modules that can also be released separately on CPAN. Modules
37 which can be released on cpan are known as "dual-life" modules.
43 This directory contains pure-Perl modules which are only released as
44 part of the core. This directory contains I<all> of the modules and
45 their tests, unlike other core modules.
49 Like F<lib/>, this directory contains modules which are only released
50 as part of the core. Unlike F<lib/>, however, a module under F<ext/>
51 generally has a CPAN-style directory- and file-layout and its own
52 F<Makefile.PL>. There is no expectation that a module under F<ext/>
53 will work with earlier versions of Perl 5. Hence, such a module may
54 take full advantage of syntactical and other improvements in Perl 5
59 This directory is for dual-life modules where the blead source is
60 canonical. Note that some modules in this directory may not yet have
61 been released separately on CPAN. Modules under F<dist/> should make
62 an effort to work with earlier versions of Perl 5.
66 This directory contains dual-life modules where the CPAN module is
67 canonical. Do not patch these modules directly! Changes to these
68 modules should be submitted to the maintainer of the CPAN module. Once
69 those changes are applied and released, the new version of the module
70 will be incorporated into the core.
74 For some dual-life modules, it has not yet been determined if the CPAN
75 version or the blead source is canonical. Until that is done, those
76 modules should be in F<cpan/>.
80 The Perl core has an extensive test suite. If you add new tests (or new
81 modules with tests), you may need to update the F<t/TEST> file so that
88 Tests for core modules in the F<lib/> directory are right next to the
89 module itself. For example, we have F<lib/strict.pm> and
92 Tests for modules in F<ext/> and the dual-life modules are in F<t/>
93 subdirectories for each module, like a standard CPAN distribution.
97 Tests for the absolute basic functionality of Perl. This includes
98 C<if>, basic file reads and writes, simple regexes, etc. These are run
99 first in the test suite and if any of them fail, something is I<really>
104 Tests for basic control structures, C<if>/C<else>, C<while>, subroutines,
109 Tests for basic issues of how Perl parses and compiles itself.
113 Tests for built-in IO functions, including command line arguments.
117 Tests for perl's method resolution order implementations (see L<mro>).
121 Tests for perl's built in functions that don't fit into any of the
124 =item * F<t/opbasic/>
126 Tests for perl's built in functions which, like those in F<t/op/>, do
127 not fit into any of the other directories, but which, in addition,
128 cannot use F<t/test.pl>,as that program depends on functionality which
129 the test file itself is testing.
133 Tests for regex related functions or behaviour. (These used to live in
138 Tests for features of how perl actually runs, including exit codes and
139 handling of PERL* environment variables.
143 Tests for the core support of Unicode.
147 Windows-specific tests.
149 =item * F<t/porting/>
151 Tests the state of the source tree for various common errors. For
152 example, it tests that everyone who is listed in the git log has a
153 corresponding entry in the F<AUTHORS> file.
157 The old home for the module tests, you shouldn't put anything new in
158 here. There are still some bits and pieces hanging around in here that
159 need to be moved. Perhaps you could move them? Thanks!
165 All of the core documentation intended for end users lives in F<pod/>.
166 Individual modules in F<lib/>, F<ext/>, F<dist/>, and F<cpan/> usually
167 have their own documentation, either in the F<Module.pm> file or an
168 accompanying F<Module.pod> file.
170 Finally, documentation intended for core Perl developers lives in the
171 F<Porting/> directory.
173 =head2 Hacking tools and documentation
175 The F<Porting> directory contains a grab bag of code and documentation
176 intended to help porters work on Perl. Some of the highlights include:
182 These are scripts which will check the source things like ANSI C
183 violations, POD encoding issues, etc.
185 =item * F<Maintainers>, F<Maintainers.pl>, and F<Maintainers.pm>
187 These files contain information on who maintains which modules. Run
188 C<perl Porting/Maintainers -M Module::Name> to find out more
189 information about a dual-life module.
193 Tidies a pod file. It's a good idea to run this on a pod file you've
200 The Perl build system on *nix-like systems starts with the F<Configure>
201 script in the root directory.
203 Platform-specific pieces of the build system also live in
204 platform-specific directories like F<win32/>, F<vms/>, etc.
205 Windows and VMS have their own Configure-like scripts, in their
206 respective directories.
208 The F<Configure> script (or a platform-specific similar script) is
209 ultimately responsible for generating a F<Makefile> from F<Makefile.SH>.
211 The build system that Perl uses is called metaconfig. This system is
212 maintained separately from the Perl core, and knows about the
213 platform-specific Configure-like scripts, as well as F<Configure>
216 The metaconfig system has its own git repository. Please see its README
217 file in L<https://github.com/Perl/metaconfig> for more details.
219 The F<Cross> directory contains various files related to
220 cross-compiling Perl. See F<Cross/README> for more details.
224 This file lists everyone who's contributed to Perl. If you submit a
225 patch, you should add your name to this file as part of the patch.
229 The F<MANIFEST> file in the root of the source tree contains a list of
230 every file in the Perl core, as well as a brief description of each
233 You can get an overview of all the files with this command:
235 % perl -lne 'print if /^[^\/]+\.[ch]\s+/' MANIFEST