---
name: "Module::Install-Cookbook"
section: "3pm"
platform: "linux"
package: "libmodule-install-perl"
version: "0.34-2"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/Module::Install-Cookbook"
---

# Module::Install-Cookbook(3pm)

A Cornucopiae of Module::Install Recipes

## NAME

Module::Install-Cookbook - A Cornucopiae of Module::Install Recipes

## DESCRIPTION

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!

## Appetizers

**Replacing "ExtUtils::MakeMaker"**

- Problem

  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?

- Solution

  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.

- Problem

  XXX *Build.PL*

- Solution

  ## Fast Food

XXX: to be written

## The Main Course

- Problem

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

- Solution

  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

## SEE ALSO

For generic information, see Module::Install.

## AUTHOR

Autrijus Tang \<autrijus@autrijus.org\>

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

## COPYRIGHT

Copyright 2003, 2004 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\>
