On my media server, I wanted to set up Perl’s CPAN but when I ran install Bundle::CPAN, I ctrl-c’d out of it when I noticed that bzip2 wasn’t installed.  Silly me.  Soon after I started receiving:

Can’t call method “value” on an undefined value at /usr/share/perl5/IO/Uncompress/RawInflate.pm

Reinstalling Perl and all the related ubuntu packages doesn’t fix it, nor does removing the ~root/.cpan dir.  There is an easy workaround though.

# aptitude remove libcompress-raw-zlib-perl
Reading package lists… Done
Building dependency tree      
Reading state information… Done
Reading extended state information      
Initializing package states… Done
Building tag database… Done      
The following packages are BROKEN:
  libio-compress-zlib-perl
The following packages have been kept back:
  bind9-host dnsutils libbind9-30 libisccfg30
The following packages will be REMOVED:
  libcompress-raw-zlib-perl
0 packages upgraded, 0 newly installed, 1 to remove and 4 not upgraded.
Need to get 0B of archives. After unpacking 319kB will be freed.
The following packages have unmet dependencies:
  libio-compress-zlib-perl: Depends: libcompress-raw-zlib-perl (>= 2.008) but it is not installable
Resolving dependencies…
The following actions will resolve these dependencies:

Remove the following packages:
apparmor-utils
libcompress-zlib-perl
libio-compress-zlib-perl
libmp3-tag-perl
librpc-xml-perl
libwww-perl
libxml-parser-perl
ubuntu-standard

Score is 592

Accept this solution? [Y/n/q/?]

Make a note of the packages that it will remove, then tell it to go ahead. It will remove these packages!

Start cpan, and type in

install Bundle::CPAN

. When it is complete, reinstall the ubuntu packages that you removed earlier (for example):

# aptitude install apparmor-utils libcompress-zlib-perl libio-compress-zlib-perl libmp3-tag-perl librpc-xml-perl libwww-perl libxml-parser-perl ubuntu-standard

That’s it. Your cpan is working again :)