aboutsummaryrefslogtreecommitdiff
path: root/plugins/externaldemo
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-10-21 17:09:57 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-10-21 17:09:57 -0400
commit92a43d5d384ba4e504c5255989a869ced424219c (patch)
treec7e800b97dace86a2e058d017ff62fb356b741c8 /plugins/externaldemo
parent70e0c9447add5853aa745f1f1e681e849f56c6f7 (diff)
downloadikiwiki-92a43d5d384ba4e504c5255989a869ced424219c.tar
ikiwiki-92a43d5d384ba4e504c5255989a869ced424219c.tar.gz
change example to override a real function
Diffstat (limited to 'plugins/externaldemo')
-rwxr-xr-xplugins/externaldemo17
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/externaldemo b/plugins/externaldemo
index fa93e672d..4d13f2444 100755
--- a/plugins/externaldemo
+++ b/plugins/externaldemo
@@ -101,16 +101,16 @@ sub import {
# stage of ikiwiki.
rpc_call("hook", type => "preprocess", id => "externaldemo", call => "preprocess");
- # Here's an example of how to inject an arbitrary function into
- # ikiwiki. Ikiwiki will be able to call bob() just like any other
- # function. Note use of automatic memoization.
- rpc_call("inject", name => "IkiWiki::bob", call => "bob",
- memoize => 1);
-
# Here's an exmaple of how to access values in %IkiWiki::config.
print STDERR "url is set to: ".
rpc_call("getvar", "config", "url")."\n";
+ # Here's an example of how to inject an arbitrary function into
+ # ikiwiki, replacing a core function.
+ # Note use of automatic memoization.
+ rpc_call("inject", name => "IkiWiki::formattime",
+ call => "formattime", memoize => 1);
+
print STDERR "externaldemo plugin successfully imported\n";
}
@@ -126,8 +126,9 @@ sub preprocess {
return "externaldemo plugin preprocessing on $title!";
}
-sub bob {
- print STDERR "externaldemo plugin's bob called via RPC";
+sub formattime {
+ print STDERR "externaldemo plugin's formattime called via RPC";
+ return scalar "formatted time: ".localtime(shift);
}
# Now all that's left to do is loop and handle each incoming RPC request.