portability problems

Writing CPAN modules

the builders

ExtUtils::MakeMaker vs. Module::Build vs. Module::Install

ExtUtils::MakeMaker
Module::Build
Module::Install

The Module::Build controversy

There was some controversy about Module::Build early on, in my opinion because they really screwed-up the roll-out with (1) an insufficient regard for backwards compatibility and (2) technical arguments that sounded like moot points from a practical point of view.

But most of these problems have been addressed. Both MakeMaker and Module::Build now have "prefix" and "install_base" options. Where necessary, the CPAN infrastructure has been modified to work with either of them. That includes: And recent versions of Module::Build now also generate a Makefile.PL ("auto-generated by Module::Build::Compat") so your users don't have to re-train their fingers.

The Module::Build killer app: extensibility

A key difference between Module::Build and MakeMaker is the ease of extensibility. What if you need to install something besides a perl module or script?

See the Module::Build::Cookbook Down under, ADVANCED RECIPES there are the two sections: Adding new file types to the build process and Adding new elements to the install process which together spell out what we need to know to do this.

Compare to what you need to do to extend ExtUtils::MakeMaker.

Module::Install

Caveat: I'm not a Module::Install user (and the documentation has problems): I could be off on some details.

Module::Install has a number of convenience features, some of which I don't care about (declarative syntax), and others which strike me as a very bad idea (automatic generation of the MANIFEST).

The main virtue of Module::Install, as I understand it, is that you can use it to make standalone distributions containing copies of everything they need to install. I would expect that everyone here is used to living directly connected to CPAN, but many people are operating in tightly locked down conditions, sometimes using what we would call legacy systems (Hillary Holtz points out that a typical "Scientific Linux" installation can be fairly old, essentially a moldy Redhat). With Module::Install, you can put a distribution on a disk that will (in theory) Just Work, without needing to install anything from any other source.

My personal take: This entire idea makes me queasy, it reminds me of the DLL-hell of Windows boxes of the early 90s, where the behavior of the system depended on the order of installation of different applications. However, unlike the old MS Windows system, Module::Install defers to installed modules that are more recent:

Module::Install::Bundle:

Module::Install::Bundle allows you to bundle a CPAN distribution within your distribution. When your end-users install your distribution, the bundled distribution will be installed along with yours, unless a newer version of the bundled distribution already exists on their local filesystem.
So there shouldn't be too much trouble, except in the case of bugs in the Module::Install code itself, which is always bundled in the distribution (so that the packages are portable to systems that don't have Module::Install on them yet).

Ricardo Signes on the module-authors list, October 1, 2008:

This thread started with Module::Install is a time bomb because, in large part, it bundles code that will not use later code found on the installing system. Then when there is a bug, every author must re-release a dist. That means that a fix to Module::Install means that there must be a thousand more upgrades, one for each dist using it.

And remember, Module::Install is a system built on top of ExtUtils::MakeMaker, which makes it a hack on top of hacks:

chromatic on MakeMaker (September 29, 2008 on module-authors list):

Meanwhile, the so-called reliable state of the art is a jumble of Perl which writes cross platform shell scripts to install Perl code, and you customize that by writing a superclass from which platform-specific modules inherit pseudo-methods which use regular expressions to search and replace cross-platform cross-shell code, with all of the cross-platform and cross-shell quoting issues that entails. I wish I were making any of this up. (I wrote tests for part of it.)


other stuff

The perl5wiki has an excellent comparison between MakeMaker and Module::Build (I wrote most of it).

Creating Module Distributions with Module::Install by Brian Ingerson, from the June 01, 2003 "Dr. Dobbs" does a much better job of explaining what Module::Install is for than the documentation on CPAN. Note though, the material about Module::Install also supporting Module::Build is out-of-date, that feature has been dropped.

By the way... Brian Ingerson's discussion from 2002 in Module::Install::Philosophy is a masterpiece of bad writing. It begins with an (apparent?) parody of Martin Luther King's "I had a dream speach", which offends many and illuminates little. It then goes off into an extended personal ramble about the dark days when the perl in-crowd didn't take his work (e.g. Inline) seriously, but it does not at all make clear how having Module::Install around back then would've helped matters.


Writing CPAN Modules: contents


Joseph Brenner, 22 Sep 2009