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