We could have somewhere in wiki.pl a line such as
if $WikiPlugins?==1 do ('wikiplugins.pl')or something similar so that wiki.pl doesn't need to be changed. But now how do we put the text field on the page? We have to modify BrowseCode or GetGotoBar or something else. Is there another feasible strategy?
In the current implementation there are only two ways to do this, (correct me if I am wrong, somebody), and one is a bit naughty as it means using an file for a previously unintended purpose.
The naughty way would be to put the code to call plugins into the config file.
The clean way is to load UseModWiki from a wrapper, with $_ set to inhibit the code from running, then do your plugin, then run &UseModWiki::DoWikiRequest. The wrapper then is what gets put into the web cgi-bin space for the user to load.
mywiki.cgi #!/usr/bin/perl # simple example wrapper to load plugin then run DoWikiRequest # adapted from an example by CliffordAdams # $_ = 'nocgi'; # Do not run script immediately when loaded require "/full/path/from/root/to/code/dir/wiki.pl"; do "/full/path/from/root/to/code/dir/wikiplugins.pl"; &UseModWiki::DoWikiRequest(); # Do the requestThe require line will declare the variables and set the values that are set outside any of the subs in UseModWiki, but will not actually call DoWikiRequest as $_ is explicitly tested for the value 'nocgi'.
Other methods would depend on CliffordAdams liking the idea of plugins enough to facilitate them in a future release.
One simple option would be for wiki.pl to "do" a standard file that loaded plugins. Or to run every sub in an array @PlugIns?. Even more simply, the documentation could explicitly invite the use of the config file to load plugins, which then would no longer be naughty!
But my guess is that, as the wrapper approach already allows us to do anything we want between loading the variables and calling DoWikiRequest, that is probably a better approach than introducing new complexity into wiki.pl - if I were Cliff I'd be reluctant to write new code to allow people to do what the wrapper already allows.