XXX to do

Dynamische Websites mit "haserl" (kann auch Lua)

Lua

---

#! /usr/local/bin/lua

print [[ Content-Type: text/plain

Hello, world ]]

System Message: WARNING/2 (web-cgi.rst, line 59)

Definition list ends without a blank line; unexpected unindent.

---

> I've had a look at Kepler, CGILua and WSAPI, but none of them explains > how to run simple Lua cgi applications from Apache.

Here is the method I prefer, using WSAPI with request and response objects:

#! /bin/bash /path/to/kepler/bin/wsapi.cgi require("wsapi.request") require("wsapi.response") return function (env)

System Message: ERROR/3 (web-cgi.rst, line 124)

Unexpected indentation.

local request = wsapi.request.new(env) local response = wsapi.response.new() response:write("<h1>Hello</h1>") for k,v in pairs(request.GET) do

System Message: ERROR/3 (web-cgi.rst, line 128)

Unexpected indentation.
response:write(k.." = "..tostring(v).."<br/>")

System Message: WARNING/2 (web-cgi.rst, line 129)

Block quote ends without a blank line; unexpected unindent.

end return response:finish()

System Message: WARNING/2 (web-cgi.rst, line 131)

Block quote ends without a blank line; unexpected unindent.

end

Put this into hello.cgi in where you would put other CGI files, set the standard CGI permissions and access it like any CGI file. The fact that the body of the script is wrapped in a function may be a hassle for simple CGI, but the plus is that it allows you to use the exact same script with Xavante (just rename it hello.ws and put it in kepler/htdocs).

-- http://sputnik.freewisdom.org/

vim: syntax=off