Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: MakeMaker or Module::Build

by ELISHEVA (Prior)
on Mar 03, 2011 at 21:54 UTC ( #891320=note: print w/ replies, xml ) Need Help??


in reply to MakeMaker or Module::Build

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.


Comment on Re: MakeMaker or Module::Build
Re^2: MakeMaker or Module::Build
by lagrasta (Initiate) on Mar 03, 2011 at 22:36 UTC

    Thanks for that great response.

    I agree that the sub classing can be very powerful. I just thought I would get more for free :)

    I'll read up on those links. I just wasn't getting the search results I wanted, so those are greatly appreciated.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://891320]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-07-24 23:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls