CPAN

Contents:

The CPAN modules Directory
Using CPAN Modules
Creating CPAN Modules

CPAN (the Comprehensive Perl Archive Network) is the central repository for everything Perl. It contains the collected wisdom of the entire Perl community: hundreds of Perl modules and scripts, several tutorials' worth of documentation, and the entire Perl distribution. If it's written in Perl, and it's helpful and free, it's probably on CPAN. CPAN is mirrored worldwide, and you can find a nearby mirror with the CPAN multiplexer at http://www.perl.com/CPAN. The multiplexer will remember which mirror you choose so that when you visit http://www.perl.com/CPAN/ (note the trailing slash) you'll be automatically redirected to that mirror. Alternatively, you can start at www.cpan.org. The interface is different, but the data is the same.

Once you get to the main CPAN directory, you'll see some subdirectories:

CPAN modules Directory

Although CPAN contains the complete source code for Perl, plus a few binary distributions for systems bereft of C compilers, as well as a smattering of programs, CPAN is best known for its collection of modules.

When we say "modules", we mean three things: 100% pure Perl modules (described in "Modules", and "Objects"), extensions (modules depending on C code, described in "Internals and Externals"), and pragmas (modules containing special instructions for the Perl compiler, described in "Pragmatic Modules"). There are also module bundles on CPAN. Bundles are collections of modules that interoperate somehow and are typically the result of a module developer wanting to provide a turnkey solution to a set of problems. If one module depends on another module (and possibly a particular version), developers will often bundle the modules together. See Bundle-XML, for instance.

One way to browse the CPAN modules is to visit http://search.cpan.org, which provides a search engine frontend to CPAN. Another way is to visit your local CPAN mirror and enter the modules directory, where you'll see three subdirectories: by-authors, by-category, and by-name. The by-name directory may be the most useful if your browser has search capabilities--although (lamentably) some modules are only available in the author directories. If you search by category, you'll have the following choices: