Configuring CPAN

The Comprehensive Perl Archive Network (CPAN) is a collection of reusable perl code building blocks that is freely available. What this means to webmasters is that a number of prewritten scripts are available to use to build scipts you need without having to write every last line of code yourselves. (If you don’t even know what perl is, stop reading this and go find out.)
CPAN is also the name of a perl module you can download from the archive. Usually when you first setup perl, you will also setup the CPAN module and then subsequently you can use that module to download other modules from the archive.
To start CPAN in interactive mode from the command line you type:
perl -MCPAN -e shell
The first time you enter the CPAN shell you will be asked a series of configutation questions; the location of various programs on your computer and the you are presneted with a list of mirror sites which you can choose the one(s) nearest to you.
Once you have configured CPAN you can see your configuration by typing :
o conf
This will show you all the current setting for CPAN, and if you ever need to reconfigure the initial values you set, you can do:
o conf init
There are a whole series of configuration varibles you can set, and the ones that got me thinking about htis article are the history file. For some time the CPAN sheel has had readline capabilities, which means that you can get a histoory of the commands you have used in a session. (Amoung other things that his means.)
However, the last time I upgraded CPAN, when I exited it told me that I had notspecified a historyfile so none was written. This made me think about reading the man pages (‘man CPAN’ not ‘man cpan’) to see what other variables are in the configuration.
o conf histfile ~/.cpan/histfilename
o conf histsize 200
commit
Specifies that I want a file name histfilename to be created and I want it to be 200 lines long. Now when I exit from CPAN and come back in, I can use command line history to see what commands I executed last time I used the interface.

Comments are closed, but trackbacks and pingbacks are open.