Using LibXML in perl
I'm writing a script that开发者_StackOverflow社区 does XML processing. The use
is as follows:
use XML::LibXML;
But it doesn't compile:
Can't locate XML/LibXML.pm in @INC
Can anyone tell me which package do I need to install (running ubuntu). libxml2
doesn't do the trick, nor does any of the libxml-*-perl
packages.
Or, if possible, is there any better way for simple XML processing?
On Debian, it's named libxml-libxml-perl
. (Generally speaking, Debian packages of Perl distributions are named "lib".lc($perl_dist_name)."-perl"
.) I suspect it's the same on Ubuntu, being based on Debian.
libxml2
is the underlying C++ library used by XML::LibXML, not XML::LibXML itself.
There is a command named apt-file.
sudo apt-get install apt-file
apt-file update
apt-file search LibXML.pm
The package you required is libxml-libxml-perl
I think the easiest way to install "XML::LibXML" on da Debian based OS is to use this command:
aptitude install libxml-libxml-perl
For me it works, if i get this Error you also get, by trying to get a script to work.
perl -MCPAN -e 'install XML::LibXML'
should also work.
How did you install the module?
try: perl -MCPAN -e 'XML::LibXML'
from the shell.
You can identify which package you need for a given perl module by translating the module name to a pathname (e.g. XML::LibXML to XML/LibXML.pm), and doing an online package search for packages containing file paths ending with that, e.g.:
http://packages.debian.org/file:XML/LibXML.pm
or
http://packages.ubuntu.com/file:XML/LibXML.pm
On the results page, you can switch to searching a different release if you are using something other than the current default for package searches.
精彩评论