CHAPTER 4
CPAN Module
Distributions
A CPAN
MODULE IS
released into an unpredictable environment. Nothing is certain
operating system, version of Perl, and the availability of other modules will vary
from user to user. To combat this variability, CPAN modules come packaged in
module distributions. A module distribution includes all the files necessary to
build, test, and install your module.
The portability of module distributions is at the core of what makes CPAN so
extraordinarily successful. Many languages have repositories containing freely
available code modules. But only Perl's has the capability to automatically install
these modules on every supported platform with no appreciable work required on
the user's part. This chapter will show you how your modules can be packaged to
take full advantage of this remarkable capability.
Chapter 1 included examples of installing modules from module distributions;
in this chapter, I'll briefly expand on how CPAN module installation works. Then
I'll explain how to build them. Along the way, I'll also describe refinements in con
structing the module itself for maximum portability.
Module Installation
Modules are installed from module distributions using a few simple steps. The
CPAN module automates these steps, but let's look at how they work manually. I'll
be demonstrating this process on a UNIX system (Redhat Linux to be precise), but
with the proper tools listed in Chapter 1 installed, the examples should work on
Windows too.
First, you download and uncompress the module. For example, I use
1
2
lwp download to download the Memoize module from CPAN:
$ lwp download http://www.cpan.org/authors/id/M/MJ/MJD/Memoize 1.00.tar.gz
Saving to Memoize 1.00.tar.gz ...
46.2 KB received in 1 seconds (46.2 KB/sec)
1. lwp download is installed with the LWP module by Gisle Aas.
2. Written by Mark Jason Dominus
95
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved