March 30, 2003

Module::Build

If you develop in Perl you should probably be aware of Module::Build. It aims to be a replacement for the venerable ExtUtils::MakeMaker, which is what generates the Makefile whenever you run perl Makefile.PL as the first step of a module installation process. Then you run make or one of its equivalents to actually do the installation. It also works with the CPAN shell to automatically fetch and install dependencies, plus run test suites for all modules installed. It is the envy of many other languages.

While this is an amazing feat (EU::MM runs on almost as many platforms as Perl, which is huge), it points out an unfortunate problem: installing Perl modules requires a working make. Unixfolk take it for granted, but while a working equivalent (nmake) is available for Win32, it's another hoop to jump through. If you know what you're doing it's easy to get around, but most people don't -- they just want things to work.

Enter Module::Build, which replaces most of the functionality of EU::MM while being a pure-Perl module. So it will install Perl modules anywhere perl runs, which should be the whole point anyway. The build process looks almost exactly the same as it does now -- substitute ./Build for make -- and extending seems to be much easier than extending MakeMaker.

I'm interested in it because in the next couple of months I'm going to need to update the testing and installation process for OpenInteract 2. OI 1.x has no testing at all (for shame!), SPOPS does, and modifying the process for it was a royal pain -- find out what DBMS/database name/username/password to test against, find out what LDAP server/cn root/dn/dn password to test against, etc. Ugh. And that's easy! Testing OI2 will require us to create a website installation (create a server configuration with smart default values, find all the packages install them to the website), fire up a standalone web server on a particular port, execute commands against it, stop the server, etc. (I know there's an Apache::Test framework, but work with me here.) Much more complicated. But because I can do everything in Perl it shouldn't be too much of a pain.

It's also an interesting process to watch because it (along with the CPANPLUS shell) is replacing one of the core pieces of infrastructure for what makes Perl so great use -- CPAN and the ease of installing modules from authors around the world. You'd think this would be a difficult process with sniping at all sides that M::B doesn't yet implement this esoteric feature, therefore it sucks! But that doesn't seem to be happening, partially because everyone recognizes the kludges necessary for MakeMaker and partially because the process is moving along steadily and openly.

Other resources:

  • Dave Rolsky published Module::Build on perl.com a month and a half ago, which gives an excellent summary of the problems with MakeMaker and how much easier it is to extend M::B.
  • Schwern put together a set of slides titled "MakeMaker is DOOMED!"
  • M::B has a SF project with a useful mailing list
  • More about CPANPLUS from a perl.com article by Jos Boumans</a>

Next: CPAN replaced for today...
Previous: Islam == solidarity?