To use Wookee with UseMod Wiki instead of its built-in formatter, patch wiki.cgi as follows:
- Download the Wookee Perl modules from http://mb.link-m.de/wiki/Wookee.zip.
- Import Wookee.pm in wiki.cgi, using the following line of code somewhere at the start of wiki.cgi:
use Wookee;
- Change the WikiToHTML sub as follows:
sub WikiToHTML {
return BlockWiki->new()->parseBlock(shift);
}
That's all. To use additional Wookee modules, just use
them after importing Wookee itself.
To Do
- Diffs don't use Wookee yet; it'd be possible though to have that done by feeding the text into a stand-alone Paragraph object. That wouldn't take embedded blocks into account though (like <code>...</code>). Alternatively, the whole text blocks returned by diff could be fed into WikiToHTML – that might not quite look like the same text would look in its original location if it's put out of context of some block markup like
...
Known Issues
- A couple of other parts of wiki.cgi implement their own notion of what Wiki markup looks like; for instance the code that automatically updates page links when a page is renamed, and the code that extracts page links from Wiki pages. Due to Wookee's modular and open-ended design, I'm currently not sure how to handle the first issue; the second, though, could be easily handled by just having Wookee parse the page and take the page links out of the main block's info hash.
- Wookee is currently not compatible with mod_perl; the reason for this is its use of INIT and CHECK blocks in the Perl code which aren't supported by mod_perl. Rewriting the code to avoid those blocks solves the problem. (Thanks to Erik Moeller for the hint.)
Spoon: Just an observation from my own experience. Wiki (UseMod) and Wookee would not work under mod_perl, but worked under normal Perl CGI handling, for me at least.
Mychaeel: What do you mean by "doesn't work"? Does it leak memory, or does it fail to work altogether? (If so, with which error message if there is any?) I'd be very interested in getting Wookee to work under mod_perl in order to make Unreal Wiki a bit more responsive than it is right now and to relieve the server load caused by it on BeyondUnreal's web server.
When coding the Offline Wiki engine I found that Wookee leaked memory due to Perl's somewhat subpar reference counting mechanism; but I fixed that at that time.
Spoon: There are no error messages, the page does not load under mod_perl. It's like it's stuck in a loop.
Mychaeel: That is weird. Any idea where it is stuck? Does it work at least the first time a page is requested? (If so, it could be that there are some leftovers in memory after the first request.) Does the server process continue running (and perhaps eating memory), or does it stop/crash?
Spoon: (sorry for the delay). I'll have to try it again. I want to say it just kept loading, I didn't check memeory usage. Normally, global variables mess up perl scripts running in mod_perl since the namespace is not flushed when the script ends. 99% if perl script migrated to mod_perl, that have problems are, caused by this. I'll try is again ( need to finish a code release first ).
inio: Two things:\
1. was I really supposed to "Write mychaeel@beyondunreal.com an email to obtain the Wookee Perl modules." when there's a download link on Wookee?\
2. If I use Wookee; from a file that's executed via a do 'foo.pl'; rather than in the main file thats being executed it gets stuck in the big while loop in Paragraph::addParsed. Any clue why this is? Here's a stack trace if it would help.
Mychaeel: Perhaps that's the same problem as the one with trying to use Wookee with mod_perl (see above). Maybe some crucial initialization code of Wookee's isn't executed if it is included that way.