1Module::Build::Compat(3pPme)rl Programmers Reference GuiMdoedule::Build::Compat(3pm)
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
20       administrator) may expect to find a working Makefile.PL in every
21       distribution they download from CPAN.  If you want to throw them a
22       bone, you can use "Module::Build::Compat" to automatically generate a
23       Makefile.PL for you, in one of several different styles.
24
25       "Module::Build::Compat" also provides some code that helps out the
26       Makefile.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
32           is typically controlled by passing the desired style as the
33           "create_makefile_pl" parameter to "Module::Build"'s "new()" method;
34           the Makefile.PL will then be automatically created during the
35           "distdir" action.
36
37           The currently supported styles are:
38
39           small
40               A small Makefile.PL will be created that passes all
41               functionality through to the Build.PL script in the same
42               directory.  The user must already have "Module::Build"
43               installed in order to use this, or else they'll get a module-
44               not-found error.
45
46           passthrough
47               This is just like the "small" option above, but if
48               "Module::Build" is not already installed on the user's system,
49               the script will offer to use "CPAN.pm" to download it and
50               install it before continuing with the build.
51
52           traditional
53               A Makefile.PL will be created in the "traditional" style, i.e.
54               it will use "ExtUtils::MakeMaker" and won't rely on
55               "Module::Build" at all.  In order to create the Makefile.PL,
56               we'll include the "requires" and "build_requires" dependencies
57               as the "PREREQ_PM" parameter.
58
59               You don't want to use this style if during the "perl Build.PL"
60               stage you ask the user questions, or do some auto-sensing about
61               the user's environment, or if you subclass "Module::Build" to
62               do some customization, because the vanilla Makefile.PL won't do
63               any of that.
64
65       run_build_pl(args => \@ARGV)
66           This method runs the Build.PL script, passing it any arguments the
67           user may have supplied to the "perl Makefile.PL" command.  Because
68           "ExtUtils::MakeMaker" and "Module::Build" accept different
69           arguments, this method also performs some translation between the
70           two.
71
72           "run_build_pl()" accepts the following named parameters:
73
74           args
75               The "args" parameter specifies the parameters that would
76               usually appear on the command line of the "perl Makefile.PL"
77               command - typically you'll just pass a reference to @ARGV.
78
79           script
80               This is the filename of the script to run - it defaults to
81               "Build.PL".
82
83       write_makefile()
84           This method writes a 'dummy' Makefile that will pass all commands
85           through to the corresponding "Module::Build" actions.
86
87           "write_makefile()" accepts the following named parameters:
88
89           makefile
90               The name of the file to write - defaults to the string
91               "Makefile".
92

SCENARIOS

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

AUTHOR

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

SEE ALSO

133       Module::Build(3), ExtUtils::MakeMaker(3)
134
135
136
137perl v5.10.1                      2017-03-22        Module::Build::Compat(3pm)
Impressum