The main distribution point for Perl is the Comprehensive Perl Archive Network , or CPAN. This archive contains not only the source code, but also just about everything you could ever want that's Perl-related. CPAN is mirrored by dozens of sites all over the world, as well as a few down under. The main site is ftp.funet.fi (22.214.171.124). You can find a more local CPAN site by getting the file /pub/languages/perl/CPAN/MIRRORS from ftp.funet.fi . Or you can use your web browser to access the CPAN multiplex service at www.perl.com . Whenever you ask this web server for a file starting with /CPAN/ , it connects you to a CPAN site, which it chooses by looking at your domain name. Here are some popular universal resource locators (URLs) out of CPAN:
The CPAN multiplex service tries to connect you to a local, fast machine on a large bandwidth hub. This doesn't always work, however, because domain names may not reflect network connections. For example, you might have a hostname ending in .se , but you may actually be better connected to North America than to Sweden. If so, you can use the following URL to choose your own site:
Note the absence of a slash at the end of the URL. When you omit the trailing slash, the CPAN multiplexer presents a menu of CPAN mirrors from which you can select a site. So long as your web browser supports cookies, the CPAN multiplexer will automatically remember your choice next time.
The following machines should have the Perl source code plus a copy of the CPAN mirror list - both available via anonymous FTP. (Try to use the machine names rather than the numbers, since the numbers may change.)
The location of the top directory of the CPAN mirror differs on these machines, so look around once you get there. It's often something like /pub/perl/CPAN .
Under the main CPAN directory, you'll see at least the following subdirectories:
In the event you've never used anonymous FTP, here is a quick primer in the form of a sample session with comments. Text in bold typewriter font is what you should type; comments are in italics. The % represents your prompt, and should not be typed.
% ftp ftp.CPAN.org (ftp.CPAN.org is not a real site) Connected to ftp.CPAN.org. 220 CPAN FTP server (Version wu-2.4(1) Fri Dec 1 00:00:00 EST 1995) ready. Name (ftp.CPAN.org:CPAN): anonymous 331 Guest login ok, send your complete e-mail address as password. Password: email@example.com (Use your username and host here) 230 Guest login ok, access restrictions apply. ftp> cd pub/perl/CPAN/src 250 CWD command successful. ftp> binary ( You must specify binary transfer for compressed files ) 200 Type set to I. ftp> get latest.tar.gz 200 PORT command successful. 150 Opening BINARY mode data connection for FILE. 226 Transfer complete. . . ( repeat this step for each file you want ) . ftp> quit 221 Goodbye. %
Once you have the files, first unzip and untar them, and then configure, build, and install Perl:
% gunzip < latest.tar.gz | tar xvf - % cd perl5.003 (Use actual directory name) Now either one of these next two lines: % sh configure (Lowercase "c" for automatic configuration) % sh Configure (Capital "C" for manual configuration) % make (Build all of Perl) % make test (Make sure it works) % make install (You should be the superuser for this)
For retrieving and building unbundled Perl modules, the process is slightly different. Let's say you want to build and install a module named CoolMod. You'd first fetch it via ftp (1), or you could use your web browser to access the module service from http://www.perl.com/ , which always retrieves the most up-to-date version of a particular registered module. The address to feed your browser would be similar to:
Once you've gotten the file, do this:
% gunzip < CoolMod-2.34.tar.gz | tar xvf - % cd CoolMod-2.34 % perl Makefile.PL (Creates the real Makefile ) % make (Build the whole module) % make test (Make sure it works) % make install (Probably should be the superuser)
When the CoolMod module has been successfully installed (it is automatically placed in your system's Perl library path), your programs can say:
and you should be able to run man CoolMod (or maybe perldoc CoolMod ) to read the module's documentation.