Perl error: Can't locate XFileConfig.pm in @INC
-
16-06-2021 - |
Question
I'm trying to install a Perl script in my server. When I received Server access.
I installed apache2, mod_perl, activated mod_rewrite in var/www/html
when I try to execute install.cgi I get the following error:
[Wed Jun 20 21:09:36 2012] [error] Can't locate XFileConfig.pm in @INC (@INC contains: . /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 /etc/httpd) at /var/www/cgi-bin/install.cgi line 4.\nBEGIN failed--compilation aborted at /var/www/cgi-bin/install.cgi line 4.\n
I'm under Centos 5, Perl v5.8.8
Solution
- Ensure that you have XFileSharing installed.
Locate the path where lib for XFileSharing are installed. You can use following command to locate XFileConfig.pm
updatedb locate XFileConfig.pm
Add following line at top of your perl script.
use lib '<path>';
OTHER TIPS
Check module is installed or not using perl -MModule::Name -e "print 'OK';"
Install using cpan install Module::Name
.
Add path to @INC
using httpd.conf
SetEnv PERL5LIB "/path/to/directory/containing/module"
.
This adds path to @INC
permanently.
Or
use lib '/path/to/directory/containing/module';
in perl script which is using that module.
This is a temporary way and you will have to add it in every single perl script.
Or
perl -I/var/www/cgi-bin install.cgi
-I
is used to include path while running install.cgi.
Ex:
> perl -IC:\a\b -e "print @INC;"
C:\a\bC:/Perl/site/libC:/Perl/lib.