1 package ExtUtils::MakeMaker::Tutorial;
8 ExtUtils::MakeMaker::Tutorial - Writing a module with MakeMaker
12 use ExtUtils::MakeMaker;
15 NAME => 'Your::Module',
16 VERSION_FROM => 'lib/Your/Module.pm'
21 This is a short tutorial on writing a simple module with MakeMaker.
22 Its really not that hard.
27 MakeMaker modules are installed using this simple mantra
34 There are lots more commands and options, but the above will do it.
39 The basic files in a module look something like this.
45 That's all that's strictly necessary. There's additional files you might
48 lib/Your/Other/Module.pm
61 When you run Makefile.PL, it makes a Makefile. That's the whole point of
62 MakeMaker. The Makefile.PL is a simple program which loads
63 ExtUtils::MakeMaker and runs the WriteMakefile() function to generate a
66 Here's an example of what you need for a simple module:
68 use ExtUtils::MakeMaker;
71 NAME => 'Your::Module',
72 VERSION_FROM => 'lib/Your/Module.pm'
75 NAME is the top-level namespace of your module. VERSION_FROM is the file
76 which contains the $VERSION variable for the entire distribution. Typically
77 this is the same as your top-level module.
82 A simple listing of all the files in your distribution.
88 File paths in a MANIFEST always use Unix conventions (ie. /) even if you're
91 You can write this by hand or generate it with 'make manifest'.
93 See L<ExtUtils::Manifest> for more details.
98 This is the directory where your .pm and .pod files you wish to have
99 installed go. They are layed out according to namespace. So Foo::Bar
100 is F<lib/Foo/Bar.pm>.
105 Tests for your modules go here. Each test filename ends with a .t.
106 So F<t/foo.t>/ 'make test' will run these tests. The directory is flat,
107 you cannot, for example, have t/foo/bar.t run by 'make test'.
109 Tests are run from the top level of your distribution. So inside a test
110 you would refer to ./lib to enter the lib directory, for example.
115 A log of changes you've made to this module. The layout is free-form.
118 1.01 Fri Apr 11 00:21:25 PDT 2003
119 - thing() does some stuff now
120 - fixed the wiggy bug in withit()
122 1.00 Mon Apr 7 00:57:15 PDT 2003
123 - "Rain of Frogs" now supported
128 A short description of your module, what it does, why someone would use it
129 and its limitations. CPAN automatically pulls your README file out of
130 the archive and makes it available to CPAN users, it is the first thing
131 they will read to decide if your module is right for them.
136 Instructions on how to install your module along with any dependencies.
137 Suggested information to include here:
139 any extra modules required for use
140 the minimum version of Perl required
141 if only works on certain operating systems
146 A file full of regular expressions to exclude when using 'make
147 manifest' to generate the MANIFEST. These regular expressions
148 are checked against each file path found in the distribution (so
149 you're matching against "t/foo.t" not "foo.t").
153 ~$ # ignore emacs and vim backup files
154 .bak$ # ignore manual backups
155 \# # ignore CVS old revision files and emacs temp files
157 Since # can be used for comments, # must be escaped.
159 MakeMaker comes with a default MANIFEST.SKIP to avoid things like
160 version control directories and backup files. Specifying your own
161 will override this default.
171 L<perlmodstyle> gives stylistic help writing a module.
173 L<perlnewmod> gives more information about how to write a module.
175 There are modules to help you through the process of writing a module:
176 L<ExtUtils::ModuleMaker>, L<Module::Install>, L<PAR>