|Welcome to the Monastery|
Continuity: Continuation-Based Web Applicationsby awwaiid (Friar)
|on Jan 20, 2005 at 23:00 UTC||Need Help??|
I've been delaying with this one -- hoping that I could get it a little more finished before mentioning it. But I've decided that what I really need is brainpower and feedback from my fellow monks. So sorry if this is a bit muttled... I just want to get it out there.
In case you haven't heard of it, continuation-based web programming is a neat trick for building stateful applications on top of the statelessness that is the web. It is a conceptual change -- imagine that your program is running in a direct interactive environment, on the command line for example. When you prompt a user for input, your program hangs until the user enters something, and then continues on the next line.
You might have:
or similar. So, using continuations, we could do this in a web environment like this:
In order to set all this up, I first had to give perl continuations. We have Coro::Cont, but I couldn't figure out how to save these continuations to disk (which is necessary for my desired model, which is running through apache). So I created fake pure-perl continuations with Contize. Thats a story unto itself.
Once I had Contize, it was a short trip to create Continuity, which is the whole framework. This is already functional, though there are some known-issues (mostly with suspending objects to-disk, not as easy as it first may seem). I have some larger examples on my website, and I'm looking for others to try this out and help me find/fix the weaknesses.
Here is some more source to give you the idea: