For all its power and utility, the CPAN module has suffered from some significant flaws. Additionally, some vendors (named below) persist in shipping versions of perl that cannot make use of most of CPAN's power. This document is intended to help unix administrators (especially Solaris administrators) configure their systems to use CPAN.
This article is short. Read it first before doing anything. Then back up
everything you care about and read about the tools you don't understand
(h2ph, for example.)
Before installing anything (else), manually upgrade CPAN.pm
to the most recent version. Download the tarball from cpan.org, unpack,
and install as any other perl module (perl Makefile.PL; make;
make test; make install).
Do not use CPAN to install CPAN.pm. CPAN.pm
versions 1.48 and earlier do not ask permission before upgrading core
perl when installing modules that are now maintained as part of core perl
(Data::Dumper, File::Spec, etc.) For this reason,
it's important to install a recent version of CPAN.pm
and configure it to ask permission before installing prerequisites,
e.g.:
# perl -MCPAN -e shell cpan> o conf prerequisites_policy ask cpan> o conf commit cpan> quit
You can also do this when you initialize CPAN for the first time.
Set CPAN to uninstall old modules when conflicts occur with
# perl -MCPAN -e shell cpan> o conf make_install_arg UNINST=1 cpan> o conf commit cpan> quit
You can also do this when you initialize CPAN for the first time:
# perl -MCPAN -e shell cpan> o conf init <<a whole lotta questions later...>> cpan> quit
CPAN stores downloaded modules under
$HOME/.cpan/sources/authors/id/Z/ZZ/ZZZ... so if you have
trouble installing modules automatically, you can find fresh sources here.
Solaris 8 users: I feel your pain. You have two choices with regards to CPAN:
/usr/perl5/bin is where vital utilities like h2xs,
h2ph, perldoc, and find2perl live. Paraphrasing Dave
Barry, "Who installed this code? Vandals?") Also, make
sure the C compiler you build perl with is available after installation
(see below.) The simple low-budget solution: install gcc.
/usr/perl5/5.00503/sun4-solaris/Config.pm and in the
original, replace references to cc with gcc,
being careful to change the values of 'optimize' and
'cccdlflags' to reflect the appropriate gcc options
('-KPIC' -> '-fPIC', '-xO3
-xdepend' -> '-O3').
/usr/perl5/5.00503/sun4-solaris/Config.pm 'remembers'
how perl was built and is used by CPAN (via MakeMaker) to build
makefiles to install modules. You can change some of the options in
CPAN to convince it to use gcc instead of Sun's hypothetical compiler
but it's often much cleaner to erase cc from Config.pm
or just install a recent version of perl from scratch. I don't
have many comments about the Solaris packages of perl on sunfreeware.com or sunsite/ibiblio; I've had
good results with packages from both archives but I simply don't trust
anyone's package of perl, especially when Sun is involved.
Perl 5.6.0 is a troubled version. If feasible, upgrade to 5.6.1 or later.
Rarely do I have to force-install a package. Tests generally fail for
a reason and really, you should investigate the failed tests before
forcing an installation, just to ensure the test results can be safely
neglected. Some tests fail if they're run as root. Common problems
are missing library paths (requiring LD_LIBRARY_PATH and
LD_RUN_PATH to be specified) and missing or outdated .ph
files (perl-massaged include files for system libraries.) Update the
.ph files with:
cd /usr/include; h2ph -r -l .
You should only need to do this once, or whenever you update the contents
of /usr/include. See the h2ph manpage for
details (Solaris users should use
'/usr/perl5/bin/perldoc /usr/perl5/bin/h2ph'
instead...)
Smile. Have fun. Use this an opportunity to learn. Write some code or documentation and share it with the rest of us.
$Id$