Chapter 13. Writing a DistributionContents:
Starting with h2xs 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:
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. 13.1. Starting with h2xsA distribution contains the module (or collection of related modules), plus all the support files required to document, test, ship, and install the module. While you could potentially construct all these files by hand, it's much simpler to use a tool that comes with Perl, awkwardly called h2xs[76]
The h2xs tool creates a series of template files that serve as a starting point for the distribution files. You simply need to say h2xs -XAn, followed by the name of the module—in this case, Island::Plotting::Maps.[77] Here's what the output looks like:[78]
$ h2xs -XAn Island::Plotting::Maps Defaulting to backwards compatibility with perl 5.8.0 If you intend this module to be compatible with earlier perl versions, please specify a minimum perl version with the -b option. Writing Island/Plotting/Maps/Maps.pm Writing Island/Plotting/Maps/Makefile.PL Writing Island/Plotting/Maps/README Writing Island/Plotting/Maps/t/1.t Writing Island/Plotting/Maps/Changes Writing Island/Plotting/Maps/MANIFEST Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|