X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/d8c4ea783be95b0ec0f4c69a4a1f230ac0e43601..0c9fe2f99c2261bf00224120acba4fd199b28dc2:/IkiWiki/Plugin/external.pm
diff --git a/IkiWiki/Plugin/external.pm b/IkiWiki/Plugin/external.pm
index a90c5d8e2..204442c1e 100644
--- a/IkiWiki/Plugin/external.pm
+++ b/IkiWiki/Plugin/external.pm
@@ -68,7 +68,22 @@ sub rpc_call ($$;@) { #{{{
return @{$value->value};
}
elsif ($value->isa('RPC::XML::struct')) {
- return %{$value->value};
+ my %hash=%{$value->value};
+
+ # 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
+ # a hash with one key "null" pointing
+ # to an empty string.
+ if (exists $hash{null} &&
+ $hash{null} eq "" &&
+ int(keys(%hash)) == 1) {
+ return undef;
+ }
+
+ return %hash;
}
else {
return $value->value;
@@ -92,6 +107,14 @@ sub rpc_call ($$;@) { #{{{
error("XML RPC call error, unknown function: $name");
}
+ # XML-RPC v1 does not allow for nil/null/None/undef
+ # values to be transmitted, so until XML::RPC::Parser
+ # honours v2 (), send a hash with one key "null"
+ # pointing to an empty string.
+ if (! defined $ret) {
+ $ret={"null" => ""};
+ }
+
my $string=eval { RPC::XML::response->new($ret)->as_string };
if ($@ && ref $ret) {
# One common reason for serialisation to
@@ -128,9 +151,10 @@ sub setvar ($$$;@) { #{{{
my $plugin=shift;
my $varname="IkiWiki::".shift;
my $key=shift;
+ my $value=shift;
no strict 'refs';
- my $ret=$varname->{$key}=@_;
+ my $ret=$varname->{$key}=$value;
use strict 'refs';
return $ret;
} #}}}
@@ -149,8 +173,9 @@ sub setstate ($$$$;@) { #{{{
my $page=shift;
my $id=shift;
my $key=shift;
+ my $value=shift;
- return $IkiWiki::pagestate{$page}{$id}{$key}=@_;
+ return $IkiWiki::pagestate{$page}{$id}{$key}=$value;
} #}}}
sub getargv ($) { #{{{
@@ -161,8 +186,9 @@ sub getargv ($) { #{{{
sub setargv ($@) { #{{{
my $plugin=shift;
+ my $array=shift;
- @ARGV=@_;
+ @ARGV=@$array;
} #}}}
sub inject ($@) { #{{{