Chapter 13. Writing a Distribution

In Chapter 12, you created a fictional Island::Plotting::Maps module, and built the right support for Exporter so that you could include use Island::Plotting::Maps in a program.

While the resulting .pm file is useful, it’s not very practical. There’s a lot more to building a real module than just creating the .pm file. You’ll also need to consider and implement the following questions:

Installation location

How and where is the .pm file installed so a program can find the module in its @INC path?

Documentation

Where is the documentation for the module? How is the documentation installed so the user can read it?

Archive completeness

If there are any accompanying files, where are they? How can the end user know if any missing files are missing?

Testing

What test harnesses can the developer run to verify correct operation, including testing against older known bugs? Can these same tests be run by the installer to ensure proper operation in the target environment?

C-language interfaces

If the module contains C or C++ code (not covered here), how can the developer describe how to compile and link the code in the developer’s environment, or the end user environment?

As Roy Scheider uttered in the movie Jaws: “You’re gonna need a bigger boat.” That “bigger boat” is the difference between a module and a distribution.

Starting with h2xs

A distribution contains the module (or collection of related modules), plus all the support files required to document, test, ...

Get Learning Perl Objects, References, and Modules now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.