1PERLSOURCE(1) Perl Programmers Reference Guide PERLSOURCE(1)
2
3
4
6 perlsource - A guide to the Perl source tree
7
9 This document describes the layout of the Perl source tree. If you're
10 hacking on the Perl core, this will help you find what you're looking
11 for.
12
14 The Perl source tree is big. Here's some of the thing you'll find in
15 it:
16
17 C code
18 The C source code and header files mostly live in the root of the
19 source tree. There are a few platform-specific directories which
20 contain C code. In addition, some of the modules shipped with Perl
21 include C or XS code.
22
23 See perlinterp for more details on the files that make up the Perl
24 interpreter, as well as details on how it works.
25
26 Core modules
27 Modules shipped as part of the Perl core live in four subdirectories.
28 Two of these directories contain modules that live in the core, and two
29 contain modules that can also be released separately on CPAN. Modules
30 which can be released on cpan are known as "dual-life" modules.
31
32 · lib/
33
34 This directory contains pure-Perl modules which are only released
35 as part of the core. This directory contains all of the modules and
36 their tests, unlike other core modules.
37
38 · ext/
39
40 Like lib/, this directory contains modules which are only released
41 as part of the core. Unlike lib/, however, a module under ext/
42 generally has a CPAN-style directory- and file-layout and its own
43 Makefile.PL. There is no expectation that a module under ext/ will
44 work with earlier versions of Perl 5. Hence, such a module may
45 take full advantage of syntactical and other improvements in Perl 5
46 blead.
47
48 · dist/
49
50 This directory is for dual-life modules where the blead source is
51 canonical. Note that some modules in this directory may not yet
52 have been released separately on CPAN. Modules under dist/ should
53 make an effort to work with earlier versions of Perl 5.
54
55 · cpan/
56
57 This directory contains dual-life modules where the CPAN module is
58 canonical. Do not patch these modules directly! Changes to these
59 modules should be submitted to the maintainer of the CPAN module.
60 Once those changes are applied and released, the new version of the
61 module will be incorporated into the core.
62
63 For some dual-life modules, it has not yet been determined if the CPAN
64 version or the blead source is canonical. Until that is done, those
65 modules should be in cpan/.
66
67 Tests
68 The Perl core has an extensive test suite. If you add new tests (or new
69 modules with tests), you may need to update the t/TEST file so that the
70 tests are run.
71
72 · Module tests
73
74 Tests for core modules in the lib/ directory are right next to the
75 module itself. For example, we have lib/strict.pm and lib/strict.t.
76
77 Tests for modules in ext/ and the dual-life modules are in t/
78 subdirectories for each module, like a standard CPAN distribution.
79
80 · t/base/
81
82 Tests for the absolute basic functionality of Perl. This includes
83 "if", basic file reads and writes, simple regexes, etc. These are
84 run first in the test suite and if any of them fail, something is
85 really broken.
86
87 · t/cmd/
88
89 Tests for basic control structures, "if"/"else", "while",
90 subroutines, etc.
91
92 · t/comp/
93
94 Tests for basic issues of how Perl parses and compiles itself.
95
96 · t/io/
97
98 Tests for built-in IO functions, including command line arguments.
99
100 · t/mro/
101
102 Tests for perl's method resolution order implementations (see mro).
103
104 · t/op/
105
106 Tests for perl's built in functions that don't fit into any of the
107 other directories.
108
109 · t/opbasic/
110
111 Tests for perl's built in functions which, like those in t/op/, do
112 not fit into any of the other directories, but which, in addition,
113 cannot use t/test.pl,as that program depends on functionality which
114 the test file itself is testing.
115
116 · t/re/
117
118 Tests for regex related functions or behaviour. (These used to live
119 in t/op).
120
121 · t/run/
122
123 Tests for features of how perl actually runs, including exit codes
124 and handling of PERL* environment variables.
125
126 · t/uni/
127
128 Tests for the core support of Unicode.
129
130 · t/win32/
131
132 Windows-specific tests.
133
134 · t/porting/
135
136 Tests the state of the source tree for various common errors. For
137 example, it tests that everyone who is listed in the git log has a
138 corresponding entry in the AUTHORS file.
139
140 · t/lib/
141
142 The old home for the module tests, you shouldn't put anything new
143 in here. There are still some bits and pieces hanging around in
144 here that need to be moved. Perhaps you could move them? Thanks!
145
146 Documentation
147 All of the core documentation intended for end users lives in pod/.
148 Individual modules in lib/, ext/, dist/, and cpan/ usually have their
149 own documentation, either in the Module.pm file or an accompanying
150 Module.pod file.
151
152 Finally, documentation intended for core Perl developers lives in the
153 Porting/ directory.
154
155 Hacking tools and documentation
156 The Porting directory contains a grab bag of code and documentation
157 intended to help porters work on Perl. Some of the highlights include:
158
159 · check*
160
161 These are scripts which will check the source things like ANSI C
162 violations, POD encoding issues, etc.
163
164 · Maintainers, Maintainers.pl, and Maintainers.pm
165
166 These files contain information on who maintains which modules. Run
167 "perl Porting/Maintainers -M Module::Name" to find out more
168 information about a dual-life module.
169
170 · podtidy
171
172 Tidies a pod file. It's a good idea to run this on a pod file
173 you've patched.
174
175 Build system
176 The Perl build system starts with the Configure script in the root
177 directory.
178
179 Platform-specific pieces of the build system also live in platform-
180 specific directories like win32/, vms/, etc.
181
182 The Configure script is ultimately responsible for generating a
183 Makefile.
184
185 The build system that Perl uses is called metaconfig. This system is
186 maintained separately from the Perl core.
187
188 The metaconfig system has its own git repository. Please see its README
189 file in <http://perl5.git.perl.org/metaconfig.git/> for more details.
190
191 The Cross directory contains various files related to cross-compiling
192 Perl. See Cross/README for more details.
193
194 AUTHORS
195 This file lists everyone who's contributed to Perl. If you submit a
196 patch, you should add your name to this file as part of the patch.
197
198 MANIFEST
199 The MANIFEST file in the root of the source tree contains a list of
200 every file in the Perl core, as well as a brief description of each
201 file.
202
203 You can get an overview of all the files with this command:
204
205 % perl -lne 'print if /^[^\/]+\.[ch]\s+/' MANIFEST
206
207
208
209perl v5.26.3 2018-03-01 PERLSOURCE(1)