(home
Language: English, lojban)

I'm writing this in the hope that someone with more knowledge of these things than me will read it, and either help me through my difficulties or take up the coding gauntlet and fashion Zann into something usable themselves. Or plausibly that they'll write something entirely new and better, learning from my mistakes. This is all very much *nix specific, so the rest of you might as well go away.

Zann essentially comprises a Perl/Python wrapper around a Z-terp. I had a whole lot of trouble getting this working - in the end, I settled on a modified version of nitfol using the cheapglk I/O. The modifications just cause it to print a recognisable line at each prompt, so my Python script knows to stop reading and start writing, and output a few formatting codes for colour and font-style. There's also some dodgy save/restore handling thrown in. Cheapnitfol is run on a pty.

The solution I eventually came up with was to have a single daemon process kept running, and have the CGI script talk to that - telling it to start an instance of cheapnitfol, and generally to get things going. This all makes things rather ugly - for a start, unless you have a suexec-enabled server, you either have to have access to the nobody account or else make crucial files world read-writable.

So it's awkward, but still usable. For anyone who wants to set it up - and preferably try to improve it - here are the files. Just stick them all in a directory with CGI-script permissions, create "saves" and "ipc" directories, stick a z? file in, touch up another file with the same name but with ".notes" appended (e.g. touch photopia.z5.notes), then in your ipc subdirectory make a couple of fifos (mkfifo) called pidfifo and startfifo, chown and/or chmod appropriately such that whoever the scripts will be run as (probably nobody unless you have suexec funkiness) can read/write to the ipc and saves directories, and can read/write to the fifos in ipc/, and can read/write the .notes file - and lastly run "sudo -u nobody ./zdaemon.pl". Go into your favourite browser and play - "http://(pathtodir)/Zann.pl?story=(storyname)".

The source, including patches for cheapglk-0.8.7 and nitfol-0.5.