sir_lichtkind
sir_lichtkind

Reputation: 318

Should I use Module::Install or Module::Build?

I'm writing a programmer's text editor (yes another one) in Perl called Kephra, which is also a CPAN module of course and bundled with Module::Install. Recently I saw that Module::Build has gone into core, so if I switch I could reduce dependencies. Is there any other reason to switch?

Upvotes: 8

Views: 1438

Answers (3)

draegtun
draegtun

Reputation: 22570

The cud as already been chewed a bit on this before in "Which framework should I use to write modules?"

After spitting out the cud I decided to go with Module::Build but clearly different answers are possible! (though I've been happy with M::B so far).

Upvotes: 5

Adam Bellaire
Adam Bellaire

Reputation: 110509

We use Module::Build in our group.

The main reason is Easy Extensibility.

Module::Build allows you to do more with your build process in pure Perl through subclassing. If you want to do more using Module::Install, you have to have knowledge of how Makefiles work, AFAIK. Since you presumably already know Perl, this can be an advantage.

As you said, using Module::Build removes the dependency on an external make program, which can be viewed as a good thing.

However, the main cons that I can think of are:

  • Although Module::Build has hit core, not everyone will be using an up-to-date version of Perl. For users with older versions of the core, you will be creating a new dependency.
  • Lots of veterans (not necessarily Perl people) are used to the perl Makemaker.PL; make; make install paradigm, and can be thrown off by having Build.PL instead. Hopefully this isn't a big deal.
  • Module::Build has occasionally broken our builds when its functionality has changed because the documentation didn't cover an edge case which we were using. The edge case was then changed and documented, but we had to re-code our subclass to get our build to work again (this happened for us at the recent upgrade from 0.2808 to 0.3).

All that said, though, I still recommend Module::Build simply for the extensibility. If that's not an issue for you, you may be better off sticking with Module::Install.

Upvotes: 6

mat
mat

Reputation: 13353

Well, Module::Build is a pretty good module, it's supposed to be a drop in replacement for ExtUtils::MakeMaker, that is, replace the Makefile.PL by a Build.PL, which generate a Build instead of a Makefile. It was also meant as "simple things should stay simple, hard things should be possible".

Module::Install takes a different approach and generates a Makefile.

Also, don't forget that not everyone runs the latest version of everything :-)

I don't remember any comparison of those modules, but I think you could find a few things from Module::Build and Module::Install respective cpanratings pages.

Upvotes: 5

Related Questions