Can't locate IPC/Run.pm in @INC
编译perl,出现错误如下:
Can't locate IPC/Run.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.12.4 /usr/local/share/perl/5.12.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.12 /usr/share/perl/5.12 /usr/local/lib/site_perl .) at ./check_ipmi_sensor line 35.
解决方法:
原文参考:http://nets.ucar.edu/nets/intro/staff/siemsen/tools/perl.html#log4perl
Installing Perl modules with CPAN.pm (best way)
Use the CPAN.pm module. To read about it, do "perldoc CPAN", or in XEmacs use the Perldoc pull-down when you're editing a Perl file.
The first time you use CPAN.pm, it will ask a long series of questions, the answers for which can be found below. Don't answer them until you've installed ncftp on the local machine.
If you've already installed CPAN and just want to use it, do like
(as root) (sudo) perl -MCPAN -e shell install Log::Log4perl install HTML::TokeParser::Simple h q
The above will install Log4perl in /usr/lib/perl5/site_perl/5.6.1/Log/Log4perl.
I've had it happen that after a successful install like the above (no failure messages during the install) a Perl program still coudn't find the module. The .pm file was there, and in a directory listed in Perl's INC paths, but I still got the "Can't locate xyz.pm in @INC
" message. It turned out that some of the intermediate directories above the .pm file were protected without 'x', so I didn't have permissions to read the directories. To fix it at the time, I did
(as root) find /usr/local/lib/site_perl -type d -exec chmod +x {} \;
The CPAN.pm module will store modules in, like, /usr/local/lib/perl5/site_perl/5.8.4, with your version of perl. If you run CPAN.pm with a different version of perl, modules will get stored in a different place.