How do I install XML::LibXML for ActivePerl?

懵懂的女人 提交于 2019-12-19 19:41:10

问题


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


回答1:


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




回答2:


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.




回答3:


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)



回答4:


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:

  • ActivePerl
  • StrawberryPerl



回答5:


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/



来源:https://stackoverflow.com/questions/1391151/how-do-i-install-xmllibxml-for-activeperl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!