Build.PL & Makefile.PL together considered harmful

toolchain Mon 18 May 2015

A couple of times recently I've had to deal with distributions that have both a Build.PL and Makefile.PL. I've never been sure of the right way to handle such dists, and in both of the recent times I ended up with problems. From talking to various people on IRC and elsewhere, it seems like there's no good reason to have both. Personally I go with Makefile.PL (with ExtUtils::MakeMaker) if it's someone else's dist, or Dist::Zilla if it's a full adoption.

I had done a number of releases of Text::Autoformat, using Makefile.PL to make dist. But for the 1.70 release, for some reason I used Build.PL. The main module has two cuckoo modules, which don't have their own $VERSION. PAUSE wasn't happy with the 1.70 release, and as a result didn't index it. I don't understand everything about this, but KENTNL kindly raised a PAUSE bug on this. In this case I'm going to switch to Dist::Zilla (with DCONWAY's ok) and refactor the two cuckoo packages into regular modules.

You could go with Build.PL (Module::Build), but I've also had a problem with that recently. Plus it's about to be dropped from the core Perl distribution, which for me is a good argument to either go with ExtUtils::MakeMaker (which is being actively maintained at the moment), or Dist::Zilla, which isn't in core, but is actively maintained, and makes your life easy.

There are 6,330 distributions with a Build.PL on CPAN, and 27,851 with a Makefile.PL. Of those, 3767 have both. I think these are all the result of Module::Build building a Makefile.PL via Module::Build::Compat.

Are there any good reasons to have both?

Here's the script I used to find the dists, and a list of dists with Module.PL and Makefile.PL.

comments powered by Disqus