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 => 'traditional' );
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

WARNING

29       Note that "Module::Build::Compat" more often causes installation issues
30       than solves them, and each of the three Makefile.PL generation styles
31       has unique compatibility or functionality issues that are unlikely to
32       be fixed. Thus, the use of this module and "create_makefile_pl" is
33       discouraged.
34

METHODS

36       create_makefile_pl($style, $build)
37           Creates a Makefile.PL in the current directory in one of several
38           styles, based on the supplied "Module::Build" object $build.  This
39           is typically controlled by passing the desired style as the
40           "create_makefile_pl" parameter to "Module::Build"'s "new()" method;
41           the Makefile.PL will then be automatically created during the
42           "distdir" action.
43
44           The currently supported styles are:
45
46           traditional
47               A Makefile.PL will be created in the "traditional" style, i.e.
48               it will use "ExtUtils::MakeMaker" and won't rely on
49               "Module::Build" at all.  In order to create the Makefile.PL,
50               we'll include the "requires" and "build_requires" dependencies
51               as the "PREREQ_PM" parameter.
52
53               You don't want to use this style if during the "perl Build.PL"
54               stage you ask the user questions, or do some auto-sensing about
55               the user's environment, or if you subclass "Module::Build" to
56               do some customization, because the vanilla Makefile.PL won't do
57               any of that.  Many standard "Module::Build" features such as
58               "test_requires" are also not supported.
59
60           small
61               A small Makefile.PL will be created that passes all
62               functionality through to the Build.PL script in the same
63               directory.  The user must already have "Module::Build"
64               installed in order to use this, or else they'll get a module-
65               not-found error.
66
67               This style attempts (with varying success) to translate the
68               Makefile.PL protocol to Build.PL, and is unnecessary on any
69               modern toolchain that recognizes "configure_requires" metadata
70               described below, as Build.PL will be run by default in this
71               case. See
72               <https://rt.cpan.org/Public/Bug/Display.html?id=75936> for an
73               example of the issues it may cause.
74
75           passthrough (DEPRECATED)
76               This is just like the "small" option above, but if
77               "Module::Build" is not already installed on the user's system,
78               the script will offer to use "CPAN.pm" to download it and
79               install it before continuing with the build.
80
81               This option has been deprecated and may be removed in a future
82               version of Module::Build.  Modern CPAN.pm and CPANPLUS will
83               recognize the "configure_requires" metadata property and
84               install Module::Build before running Build.PL if Module::Build
85               is listed and Module::Build now adds itself to
86               configure_requires by default.
87
88               Perl 5.10.1 includes "configure_requires" support.  In the
89               future, when "configure_requires" support is deemed
90               sufficiently widespread, the "passthrough" style will be
91               removed.
92
93       run_build_pl(args => \@ARGV)
94           This method runs the Build.PL script, passing it any arguments the
95           user may have supplied to the "perl Makefile.PL" command.  Because
96           "ExtUtils::MakeMaker" and "Module::Build" accept different
97           arguments, this method also performs some translation between the
98           two.
99
100           "run_build_pl()" accepts the following named parameters:
101
102           args
103               The "args" parameter specifies the parameters that would
104               usually appear on the command line of the "perl Makefile.PL"
105               command - typically you'll just pass a reference to @ARGV.
106
107           script
108               This is the filename of the script to run - it defaults to
109               "Build.PL".
110
111       write_makefile()
112           This method writes a 'dummy' Makefile that will pass all commands
113           through to the corresponding "Module::Build" actions.
114
115           "write_makefile()" accepts the following named parameters:
116
117           makefile
118               The name of the file to write - defaults to the string
119               "Makefile".
120

SCENARIOS

122       So, some common scenarios are:
123
124       1.  Just include a Build.PL script (without a Makefile.PL script), and
125           give installation directions in a README or INSTALL document
126           explaining how to install the module.  In particular, explain that
127           the user must install "Module::Build" before installing your
128           module.
129
130           Note that if you do this, you may make things easier for yourself,
131           but harder for people with older versions of CPAN or CPANPLUS on
132           their system, because those tools generally only understand the
133           Makefile.PL/"ExtUtils::MakeMaker" way of doing things.
134
135       2.  Include a Build.PL script and a "traditional" Makefile.PL, created
136           either manually or with "create_makefile_pl()".  Users won't ever
137           have to install "Module::Build" if they use the Makefile.PL, but
138           they won't get to take advantage of "Module::Build"'s extra
139           features either.
140
141           For good measure, of course, test both the Makefile.PL and the
142           Build.PL before shipping.
143
144       3.  Include a Build.PL script and a "pass-through" Makefile.PL built
145           using "Module::Build::Compat".  This will mean that people can
146           continue to use the "old" installation commands, and they may never
147           notice that it's actually doing something else behind the scenes.
148           It will also mean that your installation process is compatible with
149           older versions of tools like CPAN and CPANPLUS.
150

AUTHOR

152       Ken Williams <kwilliams@cpan.org>
153
155       Copyright (c) 2001-2006 Ken Williams.  All rights reserved.
156
157       This library is free software; you can redistribute it and/or modify it
158       under the same terms as Perl itself.
159

SEE ALSO

161       Module::Build(3), ExtUtils::MakeMaker(3)
162
163
164
165perl v5.34.0                      2022-01-21          Module::Build::Compat(3)
Impressum