Saturday, April 03, 2010
I'll only upgrade software if there's a compelling reason to, and for me, mod_lua is a compelling reason to upgrade Apache
Nah, it's not quite time to close up shop … (so much for my April Fool's joke this year—most people missed the style changes I did for several years running, but a) most people read the entries here via the newsfeed so the visual change in layout was always lost on them, and b) I never did find that round toit I needed to change the style—anyway, I digess).
I've been looking a bit deeper into Drupal these past few days (seeing how I'm
scheduled to give a repeat of my
talk at the new West Palm Beach Drupal users
group this month—I'm giving a lot of presentations this year it seems)
and trying to get into the whole PHP framework and well … as a diversion,
I thought it might be interesting to see what type of web-based framework
one could do in Lua, and
why not attempt it using mod_lua
?
Well, the fact that I linked to the svn
respository should say
something about the stability of mod_lua
—it ain't. It's only
currently available for the latest development
version of Apache, there's no documentation (except
for the source code) and a
smattering of example code to guide the intrepid. It's also not
terribly reassuring that it hasn't been worked on for a few months.
That didn't stop me from trying it though.
I spent a few hours debugging
the module, enough for it to pass the few tests available and hopefully,
the Apache team will accept the patch (a call to memset()
to
initialize a structure to a known value before use).
Now that it doesn't crash, it does appear to be quite nice, allowing the
same access that any Apache module in C would have, and it looks like one
could effectively replace a few of the murkier modules (like mod_rewrite
)
with more straightforward Lua implementation. My initial thoughts are to
reimplement mod_litbook
(which currently only works for Apache 1.3x) using mod_lua
as a
test case (and heck—maybe even upgrade the existing
mod_litbook
to Apache 2.x so I won't have to keep running an Apache 1.3
instance just for one portion of my website).