0
votes

I am trying to run script which uses XML/LibXML package. But, XML/LibXML package is already installed. I ran following command: perl -MXML::LibXML -e 1. it did not give any output, that means this package is installed.

when i ran my script. Following error occured.

Can't locate XML/LibXML.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 .). BEGIN failed--compilation aborted.

One more point to note is there is no directory "5.8.8" under /usr/lib64/perl5/site_perl/

Please suggest to overcome this issue.

1
What's the shebang in your script? What output do you get from which perl? What output do you get from perl -MXML::LibXML\ 999? - simbabque
Re "One more point to note is there is no directory "5.8.8" under /usr/lib64/perl5/site_perl/", That's not likely to be a problem. - ikegami
Please provide the output of perl -MXML::LibXML -le'print "#!".$^X; print $INC{"XML/LibXML.pm"}' and the first line of your script. - ikegami

1 Answers

1
votes

There are three possibilities:

  • You have two installs of perl and you script is using the "wrong" one.

    Either install XML::LibXML using the perl used by the script, or replace the script's shebang (#!) line with the output of the following:

    perl -MXML::LibXML -le'print "#!".$^X'
    
  • Differences in the environment.

    If XML::LibXML was installed in a nonstandard directory, it could be that PERL5LIB was used to communicate this to perl when you executed your test, but not when you run the script.

  • A permission issue.

    This isn't very likely.

    If the script is run as the same user as your test, it's not a permission issue.

    If it is a permission issue, make sure the library directory is accessible to the user executing the script.