|There's more than one way to do things|
Re: MakeMaker or Module::Buildby ELISHEVA (Prior)
|on Mar 03, 2011 at 21:54 UTC||Need Help??|
Both are standard and the default configuration of CPAN uses Module::Build (Build.PL). Both MakeMaker (M:M) and Module::Build (M:B) are part of the Perl core (M:B since 5.9). They are both fine tools, but have different strengths.
M:M is particularly strong for configuring a C compilation process (i.e. for XS modules). M:B and is considered more portable as it implements most of its commands without calls to system.
What you consider a negative (subclassing) is in fact one of M:B's strengths. M:B achieves its portability by doing everything in Perl. Your build file will run on any machine where Perl runs. A M:B generated Makefile (for use with make - see Module::Build::Compat - "small") avoids quoting and has very short commands so it avoids at least two traps of makefiles: platform/shell specific quoting conventions and limits on command line length.
M:M by contrast passes everything through make to its generated makefile. You can customize the contents of that generated makefile, but doing it in an assuredly portable way is hard. Depending on the range of machines where you plan to install your software this may or may not matter. Make implementations vary in syntax and not all of them export environment variables set in the makefile. Additionally, makefile commands have all of the portability issues of a Perl call to system. Getting the commands just right and finding all of the gotchas are hard. See Re^7: Do Pure Perl CPAN packages really need to use ExtUtils::Command::MM? and replies for some examples of what might not work.
For packaging you might also want to consider two alternative toolsets Module::Install and Distzilla. Both can generate distros with Build.PL and Makefile.PL but they have a very different approach than either M:M or M:B to the process of customizing your distro.
You may find these two recent posts helpful, both of which contain long discussions about M:M and M:B:
The later has an in depth discussion of some issues you might want to consider if you plan a complex testing or build process and have modules that are part of the test/build process but should not be copied to runtime directories after all code generation, configuration, and tests are complete.
Whichever module you choose (or even if you decide to use both), it pays to read the documentation for Module::Build and ExtUtils::MakeMaker very carefully and also to experiment when the documentation is unclear. They are very powerful tools and if you study them carefully, you may find that you have to customize a lot less than you initially thought.