Skip to content

Commit f07efe2

Browse files
GrinnzLeont
authored andcommitted
Replace "MOTIVATIONS" section with "COMPARISON"
The MOTIVATIONS section is well out of date, and contains several one-sided arguments that are either not well solved in Module::Build or not important. A new COMPARISON section can hopefully provide a more nuanced differentiation, and direct people to use real authoring tools.
1 parent aee062f commit f07efe2

File tree

1 file changed

+39
-57
lines changed

1 file changed

+39
-57
lines changed

lib/Module/Build.pm

Lines changed: 39 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,12 @@ the "./" notation, you can do this:
9191
C<Module::Build> is a system for building, testing, and installing
9292
Perl modules. It is meant to be an alternative to
9393
C<ExtUtils::MakeMaker>. Developers may alter the behavior of the
94-
module through subclassing in a much more straightforward way than
95-
with C<MakeMaker>. It also does not require a C<make> on your system
96-
- most of the C<Module::Build> code is pure-perl and written in a very
97-
cross-platform way.
94+
module through subclassing. It also does not require a C<make> on your
95+
system - most of the C<Module::Build> code is pure-perl and written in a
96+
very cross-platform way.
9897
99-
See L<"MOTIVATIONS"> for more comparisons between C<ExtUtils::MakeMaker>
100-
and C<Module::Build>.
98+
See L<"COMPARISON"> for more comparisons between C<Module::Build> and
99+
other installer tools.
101100
102101
To install C<Module::Build>, and any other module that uses
103102
C<Module::Build> for its installation process, do the following:
@@ -980,71 +979,54 @@ ExtUtils::MakeMaker> for further information.
980979
=back
981980
982981
983-
=head1 MOTIVATIONS
982+
=head1 COMPARISON
984983
985-
There are several reasons I wanted to start over, and not just fix
986-
what I didn't like about C<MakeMaker>:
984+
A comparison between C<Module::Build> and other CPAN distribution installers.
987985
988-
=over 4
986+
=over
989987
990988
=item *
991989
992-
I don't like the core idea of C<MakeMaker>, namely that C<make> should be
993-
involved in the build process. Here are my reasons:
994-
995-
=over 4
996-
997-
=item +
998-
999-
When a person is installing a Perl module, what can you assume about
1000-
their environment? Can you assume they have C<make>? No, but you can
1001-
assume they have some version of Perl.
1002-
1003-
=item +
1004-
1005-
When a person is writing a Perl module for intended distribution, can
1006-
you assume that they know how to build a Makefile, so they can
1007-
customize their build process? No, but you can assume they know Perl,
1008-
and could customize that way.
1009-
1010-
=back
1011-
1012-
For years, these things have been a barrier to people getting the
1013-
build/install process to do what they want.
990+
L<ExtUtils::MakeMaker> requires C<make> and use of a C<Makefile>.
991+
C<Module::Build> does not, nor do other pure-perl installers following the
992+
C<Build.PL> spec such as L<Module::Build::Tiny>. In practice, this is usually
993+
not an issue for the end user, as C<make> is already required to install most
994+
CPAN modules, even on Windows.
1014995
1015996
=item *
1016997
1017-
There are several architectural decisions in C<MakeMaker> that make it
1018-
very difficult to customize its behavior. For instance, when using
1019-
C<MakeMaker> you do C<use ExtUtils::MakeMaker>, but the object created in
1020-
C<WriteMakefile()> is actually blessed into a package name that's
1021-
created on the fly, so you can't simply subclass
1022-
C<ExtUtils::MakeMaker>. There is a workaround C<MY> package that lets
1023-
you override certain C<MakeMaker> methods, but only certain explicitly
1024-
preselected (by C<MakeMaker>) methods can be overridden. Also, the method
1025-
of customization is very crude: you have to modify a string containing
1026-
the Makefile text for the particular target. Since these strings
1027-
aren't documented, and I<can't> be documented (they take on different
1028-
values depending on the platform, version of perl, version of
1029-
C<MakeMaker>, etc.), you have no guarantee that your modifications will
1030-
work on someone else's machine or after an upgrade of C<MakeMaker> or
1031-
perl.
998+
L<ExtUtils::MakeMaker> has been a core module in every version of Perl 5, and
999+
must maintain compatibility to install the majority of CPAN modules.
1000+
C<Module::Build> was added to core in Perl 5.10 and removed from core in Perl
1001+
5.20, and (like L<ExtUtils::MakeMaker>) is only updated to fix critical issues
1002+
and maintain compatibility. C<Module::Build> and other non-core installers like
1003+
L<Module::Build::Tiny> are installed from CPAN by declaring themselves as a
1004+
C<configure> phase prerequisite, and in this way any installer can be used in
1005+
place of L<ExtUtils::MakeMaker>.
10321006
10331007
=item *
10341008
1035-
It is risky to make major changes to C<MakeMaker>, since it does so many
1036-
things, is so important, and generally works. C<Module::Build> is an
1037-
entirely separate package so that I can work on it all I want, without
1038-
worrying about backward compatibility with C<MakeMaker>.
1009+
Customizing the build process with L<ExtUtils::MakeMaker> involves overriding
1010+
certain methods that form the C<Makefile> by defining the subs in the C<MY::>
1011+
namespace, requiring in-depth knowledge of C<Makefile>s, but allowing targeted
1012+
customization of the entire build. Customizing C<Module::Build> involves
1013+
subclassing C<Module::Build> itself, adding or overriding pure-perl methods
1014+
that represent build actions, which are invoked as arguments passed to the
1015+
generated C<./Build> script. This is a simpler concept but requires redefining
1016+
the standard build actions to invoke your customizations, and makes it more
1017+
difficult to combine different customizations for the same action.
1018+
L<Module::Build::Tiny> does not allow for customization.
10391019
10401020
=item *
10411021
1042-
Finally, Perl is said to be a language for system administration.
1043-
Could it really be the case that Perl isn't up to the task of building
1044-
and installing software? Even if that software is a bunch of
1045-
C<.pm> files that just need to be copied from one place to
1046-
another? My sense was that we could design a system to accomplish
1047-
this in a flexible, extensible, and friendly manner. Or die trying.
1022+
C<Module::Build> provides more features and a better experience for distribution
1023+
authors than L<ExtUtils::MakeMaker>. However, tools designed specifically for
1024+
authoring, such as L<Dist::Zilla> and its spinoffs L<Dist::Milla> and
1025+
L<Minilla>, provide these features and more, and generate a configure script
1026+
(C<Makefile.PL>/C<Build.PL>) that will use any of the various installers
1027+
separately on the end user side. L<App::ModuleBuildTiny> is an alternative
1028+
standalone authoring tool for distributions using L<Module::Build::Tiny>, which
1029+
requires only a simple two-line C<Build.PL>.
10481030
10491031
=back
10501032

0 commit comments

Comments
 (0)