Ideally, should come in two flavours:
See OpenNewText for a patch.
The text is currently hard-coded. An improvement would be to make it openly editable, with the text stored in, say
it strikes me that we're defining more and more "special" pages. The base UseModWiki script has for ex, $RCName as a config variable.
How about we streamline this into a hash:
having thought that, how does / can this tie in with MagicPages?
WikiPatches/MagicPages currently calls a module, which calls a package within itself if there's a match with the page title. Keeping magic page scripts in a module strikes me as a good thing. But what if we had:
with this construction, "Wanted" is the name of the package to call in the module -- that resolves discrepancies between the magic script's package name and the page name. Or is this a bad construction, because data is flowing in TWO ways in this hash? ie:
Of course, that would lose us the "niceness" of wikihosts being able to "drop in" script into the Magic pages module without editing the main script...
Thoughts from perl gurus? -- tarquin
There are two parts to this. The first part is how the script internally manages global variables. The second part is how the user externally loads the magic pages. With some work, you can do both at the same time.
Here's some pseudocode, to be implemented in MeatBall:InfiniteMonkey.
Launching a module
Module initialization
Once a module loads, Perl executes all the top-level code (i.e. not wrapped in a subroutine). This means you can write module initialization in the top-level. So, ...
Browse page
end of pseudocode
Now, a similar strategy could be used to acquire the name of RecentChanges. Right now, Infinite Monkey uses a global parameter $Parameter{RecentChanges} to get the name, although that parameter is set by the RecentChanges module. That's not very elegant, as a better answer might be to ask the RecentChanges module (e.g. &UseMod::RecentChanges::id). However, suppose we wanted to move the RecentChanges package to a separate file. Maybe we could similarly dynamically autoload RecentChanges when we want to query it. I'll have to think about it some more. Dynamic loading is not easy, and it may not be worth it. -- SunirShah
That all is massive overkill for the EmptyPageText feature. Let's focus on that -- it merely requires that the script loads its default text from either of the configured pages when the requested page doesn't exist. (That's also different from MagicPages? in that those are Wiki pages plus generated content, whereas EmptyPageText's special pages just serve as a storage location for Wiki text -- like Unreal:Wiki_Sidebar.) -- MichaelBuschbeck