FAQ: PERL CPAN Error "Undefined subroutine &Compress::Zlib.."

"There’s No Such Thing As A Silly Question" -- does the cliche sound familiar? In this part of pimp-my-rig reloaded, technical questions are answered. Mail them to me and I will post the answers here. If you have a better answer, by all means share it with us.

FAQ: While trying to build and upgrade PERL modules for a new box a friend came across this error and it completely stalled his work. In order to get to a solution, I replicated the build procedures with his help and found myself in the same predicament.

To illustrate, we were going to build perl modules. Getting into the PERL shell.

root@host# perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.9205)
ReadLine support enabled

cpan[1]> install Bundle::CPAN

In order to cut the story short we encountered the error below:

Undefined subroutine &Compress::Zlib::gzopen called at /usr/lib/perl/5.8.8/CPAN.pm line XXXX.

About to give up hope in this automated and supposedly seamless installation, I decided to give it a manual push. Quitting the cpan shell, I changed directory to where the source files of Compress::Zlib were located.

root@host# cd /root/.cpan/build/Compress-Zlib-2.015
root@host# perl Makefile.PL -xs
Writing Makefile for Compress::Zlib
root@host# make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
All tests successful.
Files=8, Tests=766, 3 wallclock secs ( 0.02 usr 0.21 sys + 1.76 cusr 0.67 csys = 2.66 CPU)
Result: PASS


After seeing the result of "make test" above, I had breathed a sigh of relief -- Result: PASS. Manually kicking the installation of Compress::Zlib did solve the problem. After execution of "make install", we went back to the automated install of the Bundle::CPAN module and everything went well.

I hope the above solution works for you as well.

You might also be interested in:


We at pimp-my-rig strive to keep on improving, help us reach that goal by leaving comments or constructive criticisms. Don't miss out on our next feature -- subscribe via RSS (What is RSS?).

Share This