Subject: | [PATCH] Use XML::Twig instead of XML::LibXML |
I wanted to use WWW::Mediawiki::Client, but I had trouble getting
XML::LibXML to work on Windows. I understand it's supposed to be
possible, but I couldn't manage it.
However, I looked at what WWW::Mediawiki::Client was using it for, and
discovered that it was quite easy to port it to use XML::Twig instead.
XML::Twig is much easier to get running on Windows than XML::LibXML.
The attached patch (against WWW-Mediawiki-Client-0.31) changes
WWW::Mediawiki::Client to use XML::Twig instead of XML::LibXML. It
wouldn't be hard to extend the patch so it could use either module
(automatically falling back to XML::Twig if XML::LibXML is not
installed). Let me know if you'd like me to do that.
Subject: | XML-Twig.patch |
--- lib/WWW/Mediawiki/Client.pm Sat Jul 01 10:55:08 2006
+++ lib/WWW/Mediawiki/Client.pm Thu May 01 14:08:26 2008
@@ -13,7 +13,7 @@
use VCS::Lite;
use Data::Dumper;
use WWW::Mediawiki::Client::Exceptions;
-use XML::LibXML ();
+use XML::Twig ();
use HTML::Entities qw(encode_entities);
use File::Temp ();
use Encode;
@@ -1646,8 +1646,8 @@
error => "Couldn't fetch $count pages from the server.",
res => $response,
) unless $response->is_success;
- my $parser = XML::LibXML->new;
- my $doc = $parser->parse_string($response->decoded_content);
+ my $doc = XML::Twig->new;
+ $doc->parse($response->decoded_content);
my %expecting = map {$_ => 1} @pages;
my %export = ();
my %timestamp = ();
@@ -1661,6 +1661,7 @@
$export{$page} = $text;
$timestamp{$page} = $time;
}
+ $doc->dispose;
$self->{export} = \%export;
$self->{timestamp} = \%timestamp;
}
--- Makefile.PL Sun Jun 11 05:25:52 2006
+++ Makefile.PL Thu May 01 14:09:08 2008
@@ -18,7 +18,7 @@
'HTTP::Request' => 1.40,
'HTTP::Request::Common' => 1.26,
'HTTP::Cookies' => 0,
- 'XML::LibXML' => 0,
+ 'XML::Twig' => 0,
'URI' => 1.31,
'Carp' => 0,
'Data::Dumper' => 0,