Using CPAN Modules
Most modules that you'll find on CPAN are in "tarball" form. That is, they have a file extension ending in .tar.gz, and expand into a directory with the module code and any auxiliary files, usually including a README and a Makefile.PL file.
There are four steps for making CPAN modules available to your programs: decompression, unpacking, building, and installation. How each of those steps work depend on your operating system and the module being installed, so we can't give you a foolproof recipe that will work all the time. When in doubt, read the README and INSTALL files that were hopefully distributed with the module. Also read the perlmodinstall manpage.
But you may never have to think about the installation
procedure if you use the CPAN
module (bundled with
the Perl distribution) or PPM (the Perl Package Manager, bundled with
the ActiveState distribution of Perl). To use the
CPAN
module (not to be confused with CPAN itself),
type:
% perl -MCPAN -e "shell"
at your command line to begin the configuration process. After you've answered a variety of questions about how you'd like to retrieve files, you can install a module by typing:
install Some::Module
in the CPAN
module's shell, or by
typing:
% perl -MCPAN -e "install 'Some::Module'"
from your normal command line.
If you don't have the convenience of either the
CPAN
module or PPM, you'll need to go through the steps in the following sections by hand. Instructions are provided for Unix, Windows, and Macintosh; ...
Get Programming Perl, 3rd Edition 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.