#!/usr/bin/perl
# Support for external plugins written in other languages.
-# Communication via XML RPC a pipe.
+# Communication via XML RPC to a pipe.
# See externaldemo for an example of a plugin that uses this.
package IkiWiki::Plugin::external;
my $sub = sub {
IkiWiki::Plugin::external::rpc_call($plugin, $params{call}, @_)
};
+ $sub=memoize($sub) if $params{memoize};
+
+ # This will add it to the symbol table even if not present.
+ no warnings;
eval qq{*$params{name}=\$sub};
- memoize($params{name}) if $params{memoize};
+ use warnings;
+
+ # This will ensure that everywhere it was exported to sees
+ # the injected version.
+ IkiWiki::inject(name => $params{name}, call => $sub);
return 1;
} #}}}
delete $params{call};
IkiWiki::hook(%params, call => sub {
- my $ret=IkiWiki::Plugin::external::rpc_call($plugin, $callback, @_);
- return $ret;
+ IkiWiki::Plugin::external::rpc_call($plugin, $callback, @_);
});
} #}}}