1

I am facing some problem with Perl. During execution, I am getting this error.

Can't locate XML/LibXML/NodeList.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/local/lib64/perl5/XML/LibXML.pm line 25.

But when I tried to find this file using locate command i found it under. /usr/local/lib/perl5/site_perl/5.18.0/x86_64-linux/XML/LibXML/ directory.

I have installed different perl packages and they are all installed correctly. If I put single file at specified location then it will complain about another file. So putting file manually is not an good idea.

So how do i change its path to so it can execute the files from correct directory?

Edit

Can't locate loadable object for module XML::LibXML 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/local/lib64/perl5/XML/LibXML.pm line 154
[Wed Jul 03 10:15:13 2013] [error] [client 192.73.242.136] BEGIN failed--compilation aborted at /usr/local/lib64/perl5/XML/LibXML.pm line 154.
[Wed Jul 03 10:15:13 2013] [error] [client 192.73.242.136] Compilation failed in require at /var/www/cgi-bin/astpp/astpp-cdr-xml.cgi line 23.
[Wed Jul 03 10:15:13 2013] [error] [client 192.73.242.136] BEGIN failed--compilation aborted at /var/www/cgi-bin/astpp/astpp-cdr-xml.cgi line 23.
[Wed Jul 03 10:15:13 2013] [error] [client 192.73.242.136] Premature end of script headers: astpp-cdr-xml.cgi
doubleDown
  • 8,048
  • 1
  • 32
  • 48
Juned
  • 6,290
  • 7
  • 45
  • 93
  • possible duplicate of [How do I include a Perl module that's in a different directory?](http://stackoverflow.com/questions/841785/how-do-i-include-a-perl-module-thats-in-a-different-directory) – m0skit0 Jul 03 '13 at 10:55

2 Answers2

6

The instance of XML::LibXML that you have found probably belongs to a different installation of perl. It may not work even if you extend the search path to include its location.

You should install the library afresh, using whatever tool is appropriate - probably cpan.

Borodin
  • 126,100
  • 9
  • 70
  • 144
  • I have tried with `cpan -fi XML::LibXML::Nodelist` even this module was installed correctly i am getting this error. – Juned Jul 03 '13 at 13:01
  • The `XML::LibXML::Nodelist` package is part of `XML::LibXML`. Just enter `cpan XML::LibXML`. – Borodin Jul 03 '13 at 13:23
  • still i am getting error but its different,please see my edit – Juned Jul 03 '13 at 14:15
  • 2
    @juned: *"Can't locate loadable object for module"* sounds like you've just copied `XML::LibXML` into one of the `@INC` paths of your perl installation. Either that or you've *forced* the CPAN installation and it has ignored errors that resulted in only part of the module being installed. Installation of this module involves compiling some XSUBs and the resulting C files as well as just putting Perl module files in place. I suggest you start a new question and explain *in detail* what you have done, and show the CPAN install log. – Borodin Jul 03 '13 at 15:19
0

I agree with Borodin. It appears that your Perl installation maybe different from the standard Perl already installed on the system.

What happens if you type in:

$ which perl

or

$ type perl

One of these two commands should show you which Perl program is being executed by default.

What Perl executable does the first line of your Perl program point to? (It looks something like #! /usr/bin/perl Are they two different locations?

What happens when you type in perl -V which should list all of the standard locations of where your Perl modules may be installed?

It is also possible that your installation of the XML::LibXML module is bad. I think the directory you see is for the binary program that XML::LibXML depends upon, but there should also be a Perl version that will refer to that binary somewhere like usr/local/lib/perl5/site_perl/5.18.0/XML/LibXML/.

Try reinstalling this module with CPAN and afterwards, run the following command:

$ perldoc -l XML::LibXML::Nodelist

and see where it was installed.

Community
  • 1
  • 1
David W.
  • 105,218
  • 39
  • 216
  • 337
  • `which perl` and `type perl` gives same output and `perl -V` command gives lots of detail. – Juned Jul 03 '13 at 12:57
  • @juned They both list where Perl gets executed from. Sometimes one work, sometimes the other. The question is where do they say Perl is located vs. where it says so in your Perl script. For example, `type perl` says `/usr/bin/perl` and the top of your script says `#! /usr/local/bin/perl`. Does the line on the top of your Perl script differ from the location of Perl in `type perl`? – David W. Jul 03 '13 at 14:25
  • @juned Yes `perl -V` gives a lot of information, but the very last bit list what's in `@INC` which is the default search path of your Perl modules. Try this `perl -Mfeature=say -e 'say join "\n", @INC;'` command to get the list of your module directories. – David W. Jul 03 '13 at 14:56