(Prompted by a Q from "Pauli Soininen" on comp.lang.tcl)
Here's what I do to get CGI going:
#! /path/to/tclkit
puts "Content-Type: text/plain\n"
parray envOnce this is in place, I always use starkits - either wrapped (e.g. "try.kit") or unwrapped. The latter is convenient for development, it can be wrapped up later on, once you decide to freeze things.
Let me describe the process, with lots of small steps to resolve everything:
puts "Content-Type: text/plain\n"
parray envsdx qwrap try.tcl
./try.kit
rm try.tcl
#!/bin/sh
exec /path/to/tclkit /path/to/try.kitOk, everything is ready to handle real apps as CGI.
One quick way to get going is to unpack the "try.kit" produced above, and modify/extend it as needed, so here goes:
sdx unwrap try.kit
#!/bin/sh
exec /path/to/tclkit /path/to/try.vfs/main.tclNow CGI works, wrapped starkits work, and unwrapped mode has been set up. It's time to make changes and extend things with real application logic:
edit try.vfs/lib/app-try/try.tcl
That leads to a setup with files which can be edited and tested in unwrapped mode.
When everything is working, you can quickly seal it all as a starkit:
sdx wrap try.kit (this will take try.vfs/ as input)
#!/bin/sh
exec /path/to/tclkit /path/to/try.kitYou can delete the try.vfs area (it can be reconstructed at any time by doing "sdx unwrap try.kit").
If you want a single-file version, i.e. a self-contained executable CGI application which can be shipped to run out of the box (for a specific platform):
wget https://www.equi4.com/pub/tk/tclkit-freebsd-x86.gz
gzip -d tclkit-freebsd-x86.gzsdx wrap try.cgi -runtime tclkit-freebsd-x86 (this uses try.vfs/ again)
Small point of attention: if you create a starpack for the same platform you're on, you need to specify a temp *copy* of tclkit, otherwise sdx won't be able to merge it into the starpack.
See also: