Go to content Go to navigation Go to search

Setup: cpan · Jan 12, 10:03 AM by Dylan Doxey

Fresh System

Every once in a while I find myself starting up cpan on a fresh machine. The first thing cpan wants to do is refer to its configuration module for information about its dependent utilities such as lynx and ncftpget.

The the configuration module is located at: ~/.cpan/CPAN/MyConfig.pm
Or in some cases: /etc/perl/CPAN/Config.pm

In this module you'll find the definition of a hash ref called $CPAN::Config. Clearly cpan intends to 'do' this module to become aware of where its favorite binaries are located. Among other things, it's specifically interested in:

  'ftp' => q[/usr/bin/ftp],
  'gpg' => q[/usr/bin/gpg],
  'gzip' => q[/bin/gzip],
  'lynx' => q[/usr/bin/lynx],
  'make' => q[/usr/bin/make],
  'ncftp' => q[/usr/bin/ncftp],
  'tar' => q[/bin/tar],
  'unzip' => q[/usr/bin/unzip],
  'wget' => q[/usr/bin/wget],

So, to make the cpan setup process go as quickly as possible you might install any missing dependencies first. For my typical (X)Ubuntu systems, I have only needed:

sudo apt-get install lynx
sudo apt-get install ncftp

Because your mileage may vary, here's a complete list:

sudo apt-get install ftp
sudo apt-get install getcwd
sudo apt-get install gpg
sudo apt-get install gzip
sudo apt-get install lynx
sudo apt-get install make
sudo apt-get install ncftp
sudo apt-get install tar
sudo apt-get install unzip
sudo apt-get install wget

It's also worth noting at this point that if your going to use cpan much, then you will inevitably see the message "install seems impossible" when you're attempting to install some module. The first few times I saw this, I ranted quite a bit regarding the sense of saying something is "impossible" to install from source, and then found some non-cpan or non-Perl workaround.

On [X]?Ubuntu systems you can resolve this by installing the build-essentials package. Looking into the .deb file I found a list of the "essential packages", which are essential for compiling Perl modules.

essential-packages-list

base-files
base-passwd
bash
bsdutils
coreutils
debianutils
diff
dpkg
e2fsprogs
findutils
grep
gzip
hostname
login
mktemp
mount
ncurses-base
ncurses-bin
perl-base
sed
sysvinit
tar
util-linux

Just for the record, you install build-essentials like this:

sudo apt-get install build-essentials

UPDATE: You might need to specify build-essential (singular case) like this:

sudo apt-get install build-essential

Commenting is closed for this article.