How do I install XML::LibXML for ActivePerl?

2020-04-05 07:54发布

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

5条回答
仙女界的扛把子
2楼-- · 2020-04-05 08:12

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)
查看更多
叛逆
3楼-- · 2020-04-05 08:13

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.

查看更多
Ridiculous、
4楼-- · 2020-04-05 08:21

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:

查看更多
做自己的国王
5楼-- · 2020-04-05 08:22

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

查看更多
成全新的幸福
6楼-- · 2020-04-05 08:28

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/

查看更多
登录 后发表回答