X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/17b2afe721d5b8fd2468fca56e91fe83bf49be64..83b907c35e3a03d097c004b0d66cc37f45a4410d:/IkiWiki/Plugin/external.pm?ds=sidebyside
diff --git a/IkiWiki/Plugin/external.pm b/IkiWiki/Plugin/external.pm
index 066f15cf1..ec91c79db 100644
--- a/IkiWiki/Plugin/external.pm
+++ b/IkiWiki/Plugin/external.pm
@@ -8,7 +8,6 @@ use warnings;
use strict;
use IkiWiki 3.00;
use RPC::XML;
-use RPC::XML::Parser;
use IPC::Open2;
use IO::Handle;
@@ -55,7 +54,19 @@ sub rpc_call ($$;@) {
$plugin->{accum}.=$_;
while ($plugin->{accum} =~ /^\s*(<\?xml\s.*?<\/(?:methodCall|methodResponse)>)\n(.*)/s) {
$plugin->{accum}=$2;
- my $r = RPC::XML::Parser->new->parse($1);
+ my $parser;
+ eval q{
+ use RPC::XML::ParserFactory;
+ $parser = RPC::XML::ParserFactory->new;
+ };
+ if ($@) {
+ # old interface
+ eval q{
+ use RPC::XML::Parser;
+ $parser = RPC::XML::Parser->new;
+ };
+ }
+ my $r=$parser->parse($1);
error("XML RPC parser failure: $r") unless ref $r;
if ($r->isa('RPC::XML::response')) {
my $value=$r->value;
@@ -72,9 +83,9 @@ sub rpc_call ($$;@) {
# XML-RPC v1 does not allow for
# nil/null/None/undef values to be
- # transmitted, so until
- # XML::RPC::Parser honours v2
- # (), external plugins send
+ # transmitted. The extension
+ # is the right fix, but for
+ # back-compat, let external plugins send
# a hash with one key "null" pointing
# to an empty string.
if (exists $hash{null} &&
@@ -230,10 +241,13 @@ sub hook ($@) {
}
sub pagespec_match ($@) {
- # convert pagespec_match's return object into a XML RPC boolean
+ # convert return object into a XML RPC boolean
my $plugin=shift;
+ my $page=shift;
+ my $spec=shift;
- return RPC::XML::boolean->new(0 + IkiWiki::pagespec_march(@_));
+ return RPC::XML::boolean->new(0 + IkiWiki::pagespec_match(
+ $page, $spec, @_));
}
1