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