Friday, September 25, 2009

CPAN error: Recursive dependency detected

Yesterday I updated my RedHat Enterprise system with the latest security fixes, after which my primary Perl scripts stopped working.

I went into the CPAN shell and started with 'install Bundle::CPAN', which yielded the following errors:

Recursive dependency detected:
Test::Harness
=> A/AN/ANDYA/Test-Harness-3.17.tar.gz
=> File::Spec
=> S/SM/SMUELLER/PathTools-3.30.tar.gz
=> Scalar::Util
=> G/GB/GBARR/Scalar-List-Utils-1.21.tar.gz
=> Test::More
=> M/MS/MSCHWERN/Test-Simple-0.94.tar.gz
=> Test::Harness.
Cannot continue.

I found several other references to this problem, none of which provided a solution for me.

I traced the problem back to List::Util. One low-level module required version 1.21 (which was installed), but gave an error that version 1.19 was installed. I traced the problem to the fact that my Perl installation had two separate directories where List::Util was stored:

/usr/lib/perl5/5.8.8/List/Util
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/List/Util

The first directory contained version 1.21, the second directory contained version 1.19.

I solved the problem by removing the multi-thread directories for List and for Scalar:

/usr/lib/perl5/5.8.8/i386-linux-thread-multi/List
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/Scalar

After this, I was able to install Bundle::CPAN.