[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: CGI.lua - A native CGI Interface
- From: Regular Joe <237482@...>
- Date: Wed, 23 Feb 2011 16:53:49 +0100
Hello users of lua-l,
Since this is my first time on this Mailinglist, I thought I might as well start with an introduction
to a project I have been working on since the past weeks.
In short, it consists of a pure Lua CGI Implementation, that also supports RHTML-alike templates as used by the
CGILua project in Keplerproject.
HOWEVER CGI.Lua is not related to CGILua - But let me explain:
+ It appears that CGILua is more like a wsgi module for Lua, and not so much like a bareboned CGI Interface
+ The usage of CGILua is fairly non-trivial - or so it seems (just dumping my personal experience here)
+ Installation also seems a little quirky
So instead of attempting to fix a project whose API I simply couldn't quite peep through, I have decided to
sit down a minute and crank together an entirely new API.
The usage is as simple as the following:
CGI = require("CGI")
cgi = CGI()
cgi:sendHeader(200, "Content-Type", "text/html")
cgi:write("Hello World")
Or with Templates:
index.cgi:
CGI = require("CGI")
env = {}
env.words = {"Hello", "World"}
cgi = CGI()
cgi:sendHeader(200, "Content-Type", "text/html")
cgi:include("mainpage.lsp", env)
mainpage.lsp:
<p>
<% for _, word in pairs(words) do %>
<i><%= word %></i>
<% end %>
</p>
The template engine is in fact copied from the Kepler Project, mainly because it works too well to rewrite it (many thanks to the Kepler Project at this point!) ;-)
Also, the website of CGI.lua is a fullfledged Wiki Clone I have written using CGI.lua (and luamars from Mars for Operating System stuff, another project of mine:
http://github.com/nebukadnezzar/Mars).
The wiki engine isn't opensource yet, because i'm no webdesigner, and i'd rather like to hear some opinions first... :-)
CGI.lua is naturally licensed under the same license as Lua, the famous MIT/X11 License, fair trade as it should be. :-)
I look forward to opinions and criticism!
PS: This is my first time on any mailinglist actually, and I apologize if I did something incredibly silly while posting this.