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.
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.
Dirk
2008/11/8 Dirk H. Schulz dirk.schulz@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...
Dave,
--On 8. November 2008 10:04:25 +0000 Dave Cross davorg@gmail.com wrote:
The module that you want is already build as an rpm. It is contained within perl-Class-Accessor.
Thanks, installing that has helped.
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.
I will stick to installing the modules from rpms. By the way, seems that there are some missing dependencies: The module I installed for usage is perl-Nagios-Plugin, but that did not lead to installation of perl-Class-Accessor. Should I inform someone of that (whom? how?).
Thanks for your help,
Dirk
2008/11/8 Dirk H. Schulz dirk.schulz@kinzesberg.de:
I will stick to installing the modules from rpms. By the way, seems that there are some missing dependencies: The module I installed for usage is perl-Nagios-Plugin, but that did not lead to installation of perl-Class-Accessor. Should I inform someone of that (whom? how?).
That's strange. The META.yaml[1] for that module clearly includes Class::Accessor as a pre-requisite. And I'd expect that to filter through to become an rpm dependency. But looking at the spec file for the rpm[2], it's clearly missing (with a few other dependencies).
Looks like the rpm spec was built by Dag Wieers dag@wieers.com - you might want to mention your problem to him. Actually, a better approach might be to use the official RPM Forge feedback mechanisms[3].
Hope that helps,
Dave...
[1] http://search.cpan.org/src/TONVOON/Nagios-Plugin-0.27/META.yml [2] http://svn.rpmforge.net/svn/trunk/rpms/perl-Nagios-Plugin/perl-Nagios-Plugin... [3] https://rpmrepo.org/RPMforge/Feedback