HTML CSS PHP PERL

The Comprehensive Perl Archive Network (CPAN)

 
Previous Table of Contents Next

The Comprehensive Perl Archive Network (CPAN)

Perl offers additional modules to expand your development environment even further. These modules are contained in the Comprehensive Perl Archive Network (CPAN).

What Is CPAN?

CPAN is a large collection of Perl modules, programs, and documentation, contributed to the Perl community by the volunteers who wrote them.

The list of modules available in CPAN is extensive. CPAN was formed in 1995, and at the time of this writing, contains more than 7,000 modules available for installation. The modules cover a wide range of programming problems. Table 16.1 provides a short list to give you a taste of what's in CPAN.

Table 16.1. Modules in CPAN

Module Group

General Description

Tk

Graphical interface for Perl programs; specific toolkit modules are available for accessing specialty graphics libraries such as the Win32 API, Gtk, Gnome, Qt, or the X11 toolkit

Net::*

Networking modules: interfaces for Mail, Telnet, IRC, LDAP, and 40+ others

Math::*

More than 30 modules for such constructs as complex numbers, fast Fourier transforms, matrix manipulation, and so on

Date::*, Time::*

Modules for converting dates/times into and out of various formats and doing manipulations on them

Data::*, TRee::*

Modules for manipulating data structures such as linked-lists and B-trees

DBI::*

Generic interface to databases

DBD::*

Interface to commercial and free databases such as Oracle, Informix, Ingres, ODBC, Msql, MySQL, Sybase, and many others

Term::*

Fine control over text-mode screens such as DOS Command window or Unix xterms

String::*, Text::*

Dozens of modules for parsing text and formatting text

CGI::*,

Modules for producing, serving, fetching, and parsing

URI::*,

Web pages

HTML::*,

 

LWP::*,

 

WWW::*

 

GD, Graphics::*, Image::*

Modules for manipulating graphics and images

Win32::*, Win32API::*

Modules for manipulating Microsoft Windows


The most important point to remember is that a module is already available for solving most problems at least partially. The solutions in CPAN have been coded, tested, and reviewed by many programmers for completeness and correctness.

All the modules in CPAN are copyrighted by their respective authors, so you should read the README file that comes with each module to see the terms under which the module can be used. Most often, the modules are distributed under the same terms as Perl itself: by the Artistic License or by the GNU General Public License.

CPAN is also the name of a standard module used to help add additional modules into your Perl installation. The CPAN module is documented in Appendix A, "Installing Modules."

Why Do People Contribute?

Over the last half century of computer programming, programmers have solved the same problems over and over again. Searching, sorting, communicating, reading, writingthese problems have actually changed very little since the 1950s. Some books on computer programming theory and management are still applicable after 20 or 30 years.

Programmers are driven, ultimately, by solving interesting problems. Solving the same problems over and over again ("reinventing the wheel") is not always an interesting exercise and often results in inferior solutions. A typical frustration for programmers is to spend a long time and a great deal of effort to solve a complex problem, only to discover afterward that a simple and elegant solution was possible. This leads to programmers seeking ways to share code with one another. Sharing has the interesting side effect of creating better code because other programmers may notice problems in your code that you do not.

CPAN is an effort by the Perl community to save itself from unnecessary work. The modules are there to keep you from having the frustrating experience of reinventing someone else's wheel.

The quality in most of the CPAN modules is also very good because the modules, as well as Perl, are developed under the Open Source model of production. When you install a module on your system, you automatically have the source code for the module. You can examine the source yourself andbased on the licenseuse portions of the source for your own programs, modify the source, and even contact the author with suggested changes.

On the surface, the idea of CPAN seems very communal, but the actual reasons that authors contribute to CPAN are widely varied. Sometimes they contribute to help others with similar problems. Sometimes they contribute for the sake of giving to a good cause. Sometimes they do so to help gain the respect and admiration of their peersa powerful motivator. Whatever the reason, the end result is a very large body of work that you can use in your own programs.

    Previous Table of Contents Next
    © 2000- NIV