morais morais - 6 months ago 10
Perl Question

Why do I get "Can't locate loadable object for module" even after installing the module?



Could anyone point me to possible causes of Perl not finding an installed module?

$ ll /usr/share/perl5/Unix/Processors.pm
-rw-r--r-- 1 root root 3.2K Sep 11 12:39 /usr/share/perl5/Unix/Processors.pm


Ok,

$ perldoc -l Unix::Processors
/usr/share/perl5/Unix/Processors.pm


Ok, but

$ perl -MUnix::Processors -e1
Can't locate loadable object for module Unix::Processors in @INC (@INC contains: /usr/lib/cegma /usr/share/mocat/src /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at -e line 0
Compilation failed in require.
BEGIN failed--compilation aborted.





FIXED: I had put the compiled
Processors.so
next to the
.pm
when it should be in the
auto
directory.

Answer

The Unix::Processors module has an XS (C) component that has to be compiled and linked as part of the installation process. The error message Can't locate loadable object is referring to this component rather than the .pm module file itself

This is a symptom of a wrongly-installed module, and most often happens when the .pm file has been simply copied into place instead of being installed properly as described in perldoc perlmodinstall. It can also happen if the installation has been forced, regardless of any errors in the build and test phases.