Linux – Perl cannot locate module in @INC

linuxperlredhat

I am running Centos 6.4 and perl 5.10. I have short script which uses the DateTime module. However when I run my script I get the following error message telling me various modules cannot be located as they are not in the library path.

Can't locate Params/Validate.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/lib64/perl5/DateTime/Duration.pm line 11.
BEGIN failed--compilation aborted at /usr/lib64/perl5/DateTime/Duration.pm line 11.
Compilation failed in require at /usr/lib64/perl5/DateTime.pm line 45.
BEGIN failed--compilation aborted at /usr/lib64/perl5/DateTime.pm line 45.
Compilation failed in require at ./jr_fix_western_filestore.perl line 39.
BEGIN failed--compilation aborted at ./jr_fix_western_filestore.perl line 39.

All of these packages have been installed via yum. eg yum install perl-Params-Validate.x86_64 and yum install perl-DateTime.x86_64. Should the yum install not place these modules in @INC?

I have also tried to install the packages via cpan but this seems to want to download lots of dependencies first and inevitably fails.

  CPAN.pm: Going to build D/DR/DROLSKY/DateTime-1.03.tar.gz

Can't locate Module/Build.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Build.PL line 5.
BEGIN failed--compilation aborted at Build.PL line 5.
Warning: No success on command[/usr/bin/perl Build.PL --installdirs site]
Warning (usually harmless): 'YAML' not installed, will not store persistent state
  DROLSKY/DateTime-1.03.tar.gz
  /usr/bin/perl Build.PL --installdirs site -- NOT OK
Running Build test
  Make had some problems, won't test
Running Build install
  Make had some problems, won't install
Could not read '/root/.cpan/build/DateTime-1.03-Brpqo5/META.yml'. Falling back to other methods to determine prerequisites
  Warning: CPAN.pm discovered Module::Build as undeclared prerequisite.
  Adding it now as such.

When I try to install Module::Build in cpan, I get the following error

Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible
Failed during this command:
 OVID/Test-Harness-3.28.tar.gz                : make_test NO
 MSCHWERN/Test-Simple-0.98.tar.gz             : make_test NO
 JPEACOCK/version-0.9902.tar.gz               : make_test NO
 BOBTFISH/Module-Metadata-1.000014.tar.gz     : make_test NO
 DAGOLDEN/CPAN-Meta-YAML-0.008.tar.gz         : make_test NO
 MAKAMAKA/JSON-PP-2.27202.tar.gz              : make_test NO
 DAGOLDEN/Parse-CPAN-Meta-1.4404.tar.gz       : make_test NO
 DAGOLDEN/CPAN-Meta-Requirements-2.122.tar.gz : make_test NO
 DAGOLDEN/CPAN-Meta-2.130880.tar.gz           : make_test NO
 DAGOLDEN/Perl-OSType-1.003.tar.gz            : make_test NO
 JESSE/Locale-Maketext-Simple-0.21.tar.gz     : make_test NO
 BINGOS/Params-Check-0.36.tar.gz              : make_test NO
 BINGOS/Module-Load-0.24.tar.gz               : make_test NO
 BINGOS/Module-CoreList-2.91.tar.gz           : make_test NO
 BINGOS/Module-Load-Conditional-0.54.tar.gz   : make_test NO
 BINGOS/IPC-Cmd-0.80.tar.gz                   : make_test NO
 DAGOLDEN/ExtUtils-CBuilder-0.280205.tar.gz   : make_test NO
 LEONT/Module-Build-0.4005.tar.gz             : make NO

Any pointers?


rpm -ql perl-Params-Validate returns

/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Attribute
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Attribute/Params
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Attribute/Params/Validate.pm
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Params
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Params/Validate.pm
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Params/ValidatePP.pm
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Params/ValidateXS.pm
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/auto/Params
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/auto/Params/Validate
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/auto/Params/Validate/Validate.bs
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/auto/Params/Validate/Validate.so
/usr/share/doc/perl-Params-Validate-0.95
/usr/share/doc/perl-Params-Validate-0.95/Changes
/usr/share/doc/perl-Params-Validate-0.95/LICENSE
/usr/share/doc/perl-Params-Validate-0.95/MANIFEST
/usr/share/doc/perl-Params-Validate-0.95/META.yml
/usr/share/doc/perl-Params-Validate-0.95/README
/usr/share/doc/perl-Params-Validate-0.95/TODO
/usr/share/man/man3/Attribute::Params::Validate.3pm.gz
/usr/share/man/man3/Params::Validate.3pm.gz
/usr/share/man/man3/Params::ValidatePP.3pm.gz
/usr/share/man/man3/Params::ValidateXS.3pm.gz

I'm not sure if these paths are searched by @INC

However locate Validate.pm returns nothing

Best Solution

search and install

 yum install perl-CGI

this worked for me.,

Related Question