Chapter 12. Creating Your Own Perl Distribution

So far, we’ve shown Perl as a language. The rest of this book starts your education for the Perl development process. We’re almost to the point of making modules, but before we do that, we want to show how to create a Perl distribution. We don’t need a distribution to create modules, but a distribution makes development easier; most of Perl’s tools are built around the concept of the distribution. Along with that, we want to test the code as we develop it, not when we think we’re done.

Perl’s Two Build Systems

A build system takes the files that we distribute and turns them into the files we actually install. It might compile files, insert configuration into code, or anything else the developer might want to do. Once it’s transformed the files, the builder installs them.

There are two common build systems in Perl. The ExtUtils::Makemaker is built on top of make, a dependency management tool that originated with Unix developers. These distributions use a Makefile.PL to control the build. If we want to customize our build script, we have to know the language of make and we have to ensure that our additions are portable. Although ExtUtils::Makemaker is well supported, it’s at the end of its life and no new features will be added. Still, many of the CPAN distributions still use ExtUtils::Makemaker so many developers continue to use it because it’s stable and works well for common cases.

The newer system uses Module::Build, a pure-Perl tool. ...

Get Intermediate Perl, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.