On Mon, Mar 22, 2010 at 3:35 PM, Bill Moseley wrote:
So, I'm curious. Is there any kid of consensus on what to use for new
modules and why? Or is it still mostly a matter of opinion?
It's completely a matter of opinion. Schwern, who maintains
ExtUtils::MakeMaker, has said in the past that people should be using
Build.PL. Module::Install gives EU::MM a friendlier interface -- I'd
even say a new lease on life -- at the cost of increased complexity
from its black box and the risk that you, as a distribution the
author, might have to re-release everything if a bug is discovered in
Module::Install. Module::Build has gotten much smoother and there's
little that Module::Install does that it can't do now (e.g.
File::ShareDir support), but still has a bootstrap problem for users
of Perl < 5.10.1 who haven't upgraded CPAN/CPANPLUS and thus don't
have support for "configure_requires".
I've started using Dist::Zilla, which you can think of as a
distribution compiler. It generates all the boilerplate cruft for
you, including either a Makefile.PL or Build.PL. It has the benefits
of Module::Install of a simpler, declarative interface (actually, just
an INI style config file), without the downside of inflicting
Module::Install on people who use your module. Unfortunately, right
now it's only good for pure Perl distros with only static
prerequisites (that describes most of CPAN, though).
So... my opinion is:
(a) never write an ExtUtils::MakeMaker yourself, it's just too painful
to get right
(b) if you have to do anything "custom" in your build or test process
-- strongly consider Module::Build because you can customize in Perl,
which makes life much easier
(c) if you have to do dynamic prereqs or are building XS, use either
Module::Install or Module::Build.
(d) if you are doing pure perl with static prerequisites, seriously
consider Dist::Zilla, or use whichever of Module::Build or
Module::Install that you're most familiar with.
(e) If you really care about separating requires and build_requires
dependencies for downstream users and OS packagers, use Module::Build,
which is the only thing that always does it correctly and is supported
by CPAN and CPANPLUS. (There is a hack to add BUILD_REQUIRES to
ExtUtils::MakeMaker, but it's recent and not well supported.)