[CentOS] Perl Trouble

Dave Cross
2008-11-08T10:04:25Z

2008/11/8 Dirk H. Schulz <dirk.schulz at
kinzesberg.de>:
> I am running several CentOS 5.2 servers with similar configuration.
>
> On all of them I received the following error when using a certain perl
> module:
>>
>> Base class package "Class::Accessor::Fast" is empty.
>>    (Perhaps you need to 'use' the module which defines that
package
>> first.)
>
> On most of the servers installing Class::Accessor::Fast manually via CPAN
> shell has resolved the problem, but there is two of them where this did not
> help.
> I know that during setup of these hosts I used yum and cpan shell both to
> install perl modules; I guess that was wrong to do.

Mixing CPAN based module installations with rpm-based module
installations is a terrible idea as rpm (or yum) and CPAN install
modules in different directories (vendor-perl vs site-perl) so you can
(as you have found) end up with two versions of the same module
installed. This is a recipe for disaster.

My advice is to never mix CPAN installations of Perl modules with rpm
installations. And given that the system installation of Perl already
comes with a number of rpm modules installed, I only ever add
rpm-based modules to that installation. If you want to do CPAN
installations then I recommend building your own version of Perl and
installing it completely separate to the system installation. You
might be interested in by presentation "Perl in RPM-Land" which goes
into this in more detail.

http://www.slideshare.net/davorg/perl-in-rpmland-presentation/

> Now even an "install Bundle::CPAN" in cpan shell does not solve
the problem.
> How can I find out what exactly goes wrong there? Googling for the error
> message does not show up anything helpful.

The module that you want is already build as an rpm. It is contained
within perl-Class-Accessor.

Your local Perl installation is, however, somewhat broken by the
sounds of it. My recommendation would be to remove all of the modules
that you have installed using CPAN (you'll find them in the site-perl
directory) and reinstall them from rpms.

Let me know if you need any more help.

Dave...