1 package ExtUtils::MakeMaker::Tutorial;
9 ExtUtils::MakeMaker::Tutorial - Writing a module with MakeMaker
13 use ExtUtils::MakeMaker;
16 NAME => 'Your::Module',
17 VERSION_FROM => 'lib/Your/Module.pm'
22 This is a short tutorial on writing a simple module with MakeMaker.
26 MakeMaker modules are installed using this simple mantra
33 There are lots more commands and options, but the above will do it.
37 The basic layout of a module looks something like this.
43 That's all that's strictly necessary. There's additional files you might
46 lib/Your/Other/Module.pm
59 When you run Makefile.PL, it makes a Makefile. That's the whole point of
60 MakeMaker. The Makefile.PL is a simple module which loads
61 ExtUtils::MakeMaker and runs the WriteMakefile() function with a few
64 Here's an example of what you need for a simple module:
66 use ExtUtils::MakeMaker;
69 NAME => 'Your::Module',
70 VERSION_FROM => 'lib/Your/Module.pm'
73 NAME is the top-level namespace of your module. VERSION_FROM is the file
74 which contains the $VERSION variable for the entire distribution. Typically
75 this is the same as your top-level module.
80 A simple listing of all the files in your distribution.
89 This is the directory where your .pm files go. They are layed out
90 according to namespace. So Foo::Bar is lib/Foo/Bar.pm.
95 Tests for your modules go here. Each test filename ends with a .t.
96 So t/foo.t. 'make test' will run these tests. The directory is flat,
97 you cannot, for example, have t/foo/bar.t run by 'make test'.
102 A log of changes you've made to this module.
117 L<perlmodstyle> gives stylistic help writing a module.
119 There are modules to help you through the process of writing a module:
120 L<ExtUtils::ModuleMaker>, L<Module::Setup>, L<CPAN::MakeMaker>