1Module::Build::Compat(3U)ser Contributed Perl DocumentatiMoondule::Build::Compat(3)
2
3
4

NAME

6       Module::Build::Compat - Compatibility with ExtUtils::MakeMaker
7

SYNOPSIS

9         # In a Build.PL :
10         use Module::Build;
11         my $build = Module::Build->new
12           ( module_name => 'Foo::Bar',
13             license     => 'perl',
14             create_makefile_pl => 'passthrough' );
15         ...
16

DESCRIPTION

18       Because ExtUtils::MakeMaker has been the standard way to distribute
19       modules for a long time, many tools (CPAN.pm, or your system adminis‐
20       trator) may expect to find a working Makefile.PL in every distribution
21       they download from CPAN.  If you want to throw them a bone, you can use
22       Module::Build::Compat to automatically generate a Makefile.PL for you,
23       in one of several different styles.
24
25       Module::Build::Compat also provides some code that helps out the Make‐
26       file.PL at runtime.
27

METHODS

29       create_makefile_pl($style, $build)
30           Creates a Makefile.PL in the current directory in one of several
31           styles, based on the supplied Module::Build object $build.  This is
32           typically controlled by passing the desired style as the "cre‐
33           ate_makefile_pl" parameter to Module::Build's "new()" method; the
34           Makefile.PL will then be automatically created during the "distdir"
35           action.
36
37           The currently supported styles are:
38
39           small
40               A small Makefile.PL will be created that passes all functional‐
41               ity through to the Build.PL script in the same directory.  The
42               user must already have Module::Build installed in order to use
43               this, or else they'll get a module-not-found error.
44
45           passthrough
46               This is just like the "small" option above, but if Mod‐
47               ule::Build is not already installed on the user's system, the
48               script will offer to use "CPAN.pm" to download it and install
49               it before continuing with the build.
50
51           traditional
52               A Makefile.PL will be created in the "traditional" style, i.e.
53               it will use "ExtUtils::MakeMaker" and won't rely on "Mod‐
54               ule::Build" at all.  In order to create the Makefile.PL, we'll
55               include the "requires" and "build_requires" dependencies as the
56               "PREREQ_PM" parameter.
57
58               You don't want to use this style if during the "perl Build.PL"
59               stage you ask the user questions, or do some auto-sensing about
60               the user's environment, or if you subclass Module::Build to do
61               some customization, because the vanilla Makefile.PL won't do
62               any of that.
63
64       run_build_pl(args => \@ARGV)
65           This method runs the Build.PL script, passing it any arguments the
66           user may have supplied to the "perl Makefile.PL" command.  Because
67           ExtUtils::MakeMaker and Module::Build accept different arguments,
68           this method also performs some translation between the two.
69
70           "run_build_pl()" accepts the following named parameters:
71
72           args
73               The "args" parameter specifies the parameters that would usu‐
74               ally appear on the command line of the "perl Makefile.PL" com‐
75               mand - typically you'll just pass a reference to @ARGV.
76
77           script
78               This is the filename of the script to run - it defaults to
79               "Build.PL".
80
81       write_makefile()
82           This method writes a 'dummy' Makefile that will pass all commands
83           through to the corresponding Module::Build actions.
84
85           "write_makefile()" accepts the following named parameters:
86
87           makefile
88               The name of the file to write - defaults to the string "Make‐
89               file".
90

SCENARIOS

92       So, some common scenarios are:
93
94       1.  Just include a Build.PL script (without a Makefile.PL script), and
95           give installation directions in a README or INSTALL document
96           explaining how to install the module.  In particular, explain that
97           the user must install Module::Build before installing your module.
98
99           Note that if you do this, you may make things easier for yourself,
100           but harder for people with older versions of CPAN or CPANPLUS on
101           their system, because those tools generally only understand the
102           Makefile.PL/"ExtUtils::MakeMaker" way of doing things.
103
104       2.  Include a Build.PL script and a "traditional" Makefile.PL, created
105           either manually or with "create_makefile_pl()".  Users won't ever
106           have to install Module::Build if they use the Makefile.PL, but they
107           won't get to take advantage of Module::Build's extra features
108           either.
109
110           If you go this route, make sure you explicitly set "PL_FILES" in
111           the call to "WriteMakefile()" (probably to an empty hash refer‐
112           ence), or else MakeMaker will mistakenly run the Build.PL and
113           you'll get an error message about "Too early to run Build script"
114           or something.  For good measure, of course, test both the Make‐
115           file.PL and the Build.PL before shipping.
116
117       3.  Include a Build.PL script and a "pass-through" Makefile.PL built
118           using Module::Build::Compat.  This will mean that people can con‐
119           tinue to use the "old" installation commands, and they may never
120           notice that it's actually doing something else behind the scenes.
121           It will also mean that your installation process is compatible with
122           older versions of tools like CPAN and CPANPLUS.
123

AUTHOR

125       Ken Williams <kwilliams@cpan.org>
126
128       Copyright (c) 2001-2006 Ken Williams.  All rights reserved.
129
130       This library is free software; you can redistribute it and/or modify it
131       under the same terms as Perl itself.
132

SEE ALSO

134       Module::Build(3), ExtUtils::MakeMaker(3)
135
136
137
138perl v5.8.8                       2007-04-02          Module::Build::Compat(3)
Impressum