++ed by:

10 PAUSE users
7 non-PAUSE users.

and 1 contributors


Module::Install-Cookbook - A Cornucopiæ of Module::Install Recipes


It's a lot easier for most of us to cook a meal from a recipe, rather than just throwing things into a pot until something edible forms. So it is with programming as well. Module::Install makes writing Perl module installers as easy as possible. Having a set of easy to understand samples, makes it simpler yet.

This Cookbook is intended to be an ever-growing repository of small yet complete coding examples; each showing how to accomplish a particular task with Module::Install. Each example is followed by a short discussion, explaining in detail the particular features that are being demonstrated.

Guten Appetit!


Replacing ExtUtils::MakeMaker


As a CPAN author, you are likely to have some ExtUtils::MakeMaker based Makefile.PL already. You want to take advantage of cool features offered by Module::Install extensions, but why fix something that's not broken?


The fix turns out to be extremely simple. Where you had:

    use ExtUtils::MakeMaker;
    WriteMakefile( NAME => "Foo::Bar" );

Now just write:

    use inc::Module::Install;
    WriteMakefile( NAME => "Foo::Bar" );

Presto! Your Makefile.PL is now ready to receive all sort of magic extensions; see below for details.


XXX Build.PL


Fast Food

XXX: to be written

The Main Course


Installing XS extensions from CPAN was difficult. Some platforms do not come with a compiler (Win32, MacOSX...); some headers or libraries may be missing.


Just use the par_base and fetch_par functions:

    # same old Makefile.PL, with a few changes
    use inc::Module::Install;           # was "use ExtUtils::MakeMaker;"
    WriteMakefile( ... );               # same as the original
    check_nmake();                      # make sure the user have nmake
    par_base('AUTRIJUS');               # your CPAN ID or a URL
    fetch_par() unless can_cc();        # use precompiled PAR only if necessary

Users will not notice anything, except now it works. Of course, you still need to type make par and upload the precompiled package.

Just Desserts

XXX: to be written

Entertaining Guests

XXX: to be written

Food for Thought

XXX: to be written


For generic information, see Module::Install.


Autrijus Tang <autrijus@autrijus.org>

Structure based on Inline::C-Cookbook by Brian Ingerson <INGY@cpan.org>


Copyright 2003 by Autrijus Tang <autrijus@autrijus.org>.

Copyright 2002 by Brian Ingerson <INGY@cpan.org>.

This document is free documentation; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 71:

'=item' outside of any '=over'

Around line 91:

You forgot a '=back' before '=head1'