The Perl You Need to Know Part 23: CPAN, a Farmer's Market for Perl - Page 164
April 16, 2001
|
This month, we'll look at using the
CPAN module to ease module
management, including finding and installing modules, especially
for users who do not have administrative access to the Perl
installation tree itself.
|
Summer in the country means "u-pick" time, when you
pull the car off onto dusty gravel roads, grab some pecks,
bushels, pints, buckets, or flats, and load up on fresh-from-the-
fields goodness. But no matter how large and varied your favorite
farm may be, it's still just one farm. Come Saturdays, or
Sundays, or Tuesdays, the farmer probably loads up his old truck
and chugs it down to the farmer's market, because he knows that's
where all the shoppers are at. And the shoppers know that's where
the farmers are at. The power of centralized distribution
benefits both seller and buyer, and the popularity of outdoor
markets — be they farmers, fleas, or even indoor malls
— stand as a testament to centralization. It's often said
that in Perl community is one of its greatest assets, and a major
reason for that is CPAN — the Comprehensive Perl Archive
Network. A farmer's market, if you will, especially if you're
hunting for Perl modules.
Come One, Come All
Because extending the power of Perl is as straightforward as
packaging your tool into a Perl module, authors from around the
world have been furiously hatching modules for years. Indeed,
some modules have become so significant to Perl that they've been
adopted into the "standard distribution" — the set of
modules that is included by default with a particular version of
Perl. Beyond this core of standard modules orbits hundreds of
mercenary modules, lying in wait to help you if you need them.
Without CPAN, locating a Perl module that suits your needs would
be like driving from farm to farm until you found the one that
grew cucumbers. One stop shopping at its finest, CPAN, in a
general sense, maintains a sophisticated collection of Perl
modules spanning many categories. More precisely, though, CPAN
itself is a Perl module — put another way, there is
a Perl module named CPAN with which you can browse and install
modules from the archives.
The Unprivileged User
Quite a lot of Perl documentation and conversation implicitly
assumes that you have access and control over the Perl
installation on a particular machine. Indeed, such access makes
life easier in some respects, and it's not unfair to suggest that
many people use Perl on home machines and other systems for which
they wield total control. But as Perl's popularity as a Web
authoring language has grown, many newcomers to Perl find
themselves using systems hosted by others — quite often,
their hosting service or other type of service provider.
In some cases, hosted users might be able to create a fresh Perl
installation inside their own user account. This may be
desirable, or it may not. It may be allowable, or it may not. For
the purposes of this argument, we'll assume the least privileged
scenario: users who cannot install a full Perl distribution
inside their account, and who cannot control or request that new
modules be added to the hosted Perl distribution. Anyone with
greater privileges than these should have no problem adapting the
CPAN concepts herein to their own systems. We are also assuming a
Unix-derived operating system, such as
Linux
— those who author Perl on, say, a Windows machine using
ActiveState Perl will not use CPAN, but rather ActiveState's own
module management system called
ppm.
Contents:
A Dark And Stormy Night ...
Inside CPAN
They Shoot Coders, Don't They?
A Private Stash (of modules)
A Toolbox Heritage - Page 163
The Perl You Need to Know
A Dark And Stormy Night ... - Page 165
|