Friday, May 1, 2009

cpan does not work - Undefined subroutine &Compress::Zlib::gzopen

while running cpan on a more-or-less out-of-the-box CentOS 5.2 with Perl updated to version 5.8.8 the following error occurred:

Fetching with LWP:
ftp://bo.mirror.garr.it/mirrors/CPAN/modules/03modlist.data.gz Going to read /home/egon.stemle/.cpan/sources/modules/03modlist.data.gz Undefined subroutine &Compress::Zlib::gzopen called at /usr/lib/perl5/5.8.8/CPAN.pm line 5721.

suggestions from here helped finding a solution. however, i did not want to and could not delete things from system paths... so, problem solved without deleting things in /usr/lib/...

the following modules are needed:
IO-Compress (2.017), which itself depends on two packages
Compress-Raw-Bzip2 (2.017)
Compress-Raw-Zlib (2.017)
Scalar-List-Utils (1.19)

...and then installed manually.

you need to have working local, aka. user-modules, configured, i.e. perl should look for and install modules into a directory you have r/w permissions; e.g. ~/usr (cf. this link for some hints on how to get started)

start with the Scalar-List-Utils: untar, cd into and
PERL5LIB=~/usr/lib/perl5/5.8.8:~/usr/lib/perl5/site_perl/5.8.8 perl Makefile.PL PREFIX=~/usr -xs make make test make install (you can also give the PERL5LIB path as option -I to perl - or not at all if you are really sure your local set-up is wokring...)

continue with the dependencies for IO-Compress and then IO-Compress itself.

if you want to be on very safe side you may recompile all dynamically loaded modules with
cpan -r (this will take a while - and will install many modules as a local version... watch your quota!)

anyways, afterwards i could happily use cpan to install my two(!) missing modules...
Blogged with the Flock Browser