6

I am new to Perl and I am using ActivePerl. I am getting the following error:

Can't locate XML/LibXML.pm in @INC...

I have tried everything but cannot find the steps to install the "correct" module for XML::LibXML.

Here is exactly what is going on. I am running a script from a command prompt:

c:\temp>perl myscript.pl

The first few lines of myscript.pl:

#!/usr/bin/perl

use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
use HTTP::Date;
use XML::Parser;
use LWP::UserAgent;
use XML::LibXML;
use Archive::Extract;
use Encode;
use LWP::Simple;

require HTTP::Request;
...

Then I get this error:

c:\temp>perl myscript.pl Can't locate XML/LibXML.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .) at myscript.pl line 7. BEGIN failed--compilation aborted at myscript.pl line 7

mirod
  • 15,333
  • 3
  • 44
  • 64
Jamey McElveen
  • 17,547
  • 25
  • 86
  • 126

5 Answers5

7

You should be able to install it with the ActivePerl Perl Package Manager. There should have been a start menu shortcut created when you installed ActivePerl, start the GUI and search for xml-libxml and libxml-perl.

--edit

Here's a post on adding an alternative repository to PPM and installing XML-LibXML

Community
  • 1
  • 1
robertc
  • 69,665
  • 18
  • 184
  • 170
3

It doesn't look like ActiveState provide a PPM with XML::LibXML. I looked in the README for the module on CPAN and apparently a prebuild ppm package is available here.

Martin
  • 4,741
  • 3
  • 15
  • 16
  • above link is 503 error for me, but sources available from cpan here http://search.cpan.org/perldoc?XML%3A%3ALibXML – RJFalconer Jan 17 '13 at 12:46
2

I have recently been through the pains of getting XML::LibXML installed. Here is what I found:

  1. We are using ActiveState ActivePerl 5.8.8
  2. In order for ActivePerl's PPM to get through our proxy, had to create an environment variable "http_proxy" with value "http://proxy.ext.[example].com", then re-login.
  3. The required packages weren't all located in ActiveState's repository. Added University of Winnipeg's Perl Repository http://theoryx5.uwinnipeg.ca/ppms/package.xml (note that the exact repository used depends on your version of ActivePerl)
  4. Manually install the following DLLs into C:\perl\bin\ (for whatever reason, I was having some trouble building these DLLs, so I ended up simply grabbing them from the repository at http://trouchelle.com/ppm/dll/ )
    • iconv.dll
    • libxml2.dll
    • zlib1.dll
  5. At least for the version of XML-LibXML we are using, the package installer doesn't work correctly for the prerequisite XML-LibXML-Common. You MUST install the package XML-LibXML-Common by itself, BEFORE installing the rest of XML-LibXML.

Although they may not be the latest versions, the versions of the packages (including prerequisites) which I am currently using are:

  • XML-LibXML-Common (ver 0.13)
  • XML-LibXML (ver 1.64)
  • XML-NamespaceSupport (ver 1.10)
  • XML-SAX (ver 0.96)
sn00gan
  • 69
  • 4
  • I have the same issue today. Did you just copy those 3 .dll in the folder C:\Perl\bin\ ? Using search from ppm, it only returns libxml-perl [0.08] libxml-perl – laurentngu Aug 16 '12 at 13:59
  • Yes, I just copied those 3 DLLs which I described. – sn00gan Jun 24 '13 at 21:50
1

Accepted answer didn't work for me on 5.16. From this question:

XML::LibXML was not ready for Perl 5.16. Install 5.14

Download:

Community
  • 1
  • 1
RJFalconer
  • 8,488
  • 3
  • 44
  • 58
0

In the end I found the only alternative ActivePerl repository in existence, as far as I can tell, and it had a package for XML::LibXML 2.0121 which will install on perl versions up to 5.20.x.

You can obtain releases of ActivePerl from here that includes 5.20.2: downloads.activestate.com/ActivePerl/releases/

The alternative repository is called Bribes de Perl at bribes.org/perl/

The URL of the repository that is entered in options is http://bribes.org/perl/ppm/