COMMANDS:
Special mod_dtcl commandsbuffer_add
- add text to output_buffer for
later printing. Used internally.hputs ?-error?
- like puts, but to the client instead of stdout.
The error option permits you to send an
'error message' to the apache log file, at
the NOTICE level.
hgetvars
- get the environmental vars.
This is in a seperate command so as not to make
the server do this every time you load a .ttml
file. ENVS and VARS are the two associative
arrays loaded. ENVS contains environmental
variables, VARS contains all the 'cgi' variables.
Look in the examples.ttml file to see how these
work.
include filename
- include a flat
file. Useful for including HTML files.
parse filename
- include and parse a
ttml file (although the filename doesn't have to end in
.ttml).
hflush
- flush the output buffers to the
client - allows for incrementally outputting a page
headers setcookie
cookie-name
cookie-value
?-expires date/time?
?-domain domain?
?-path path?
?-secure?
- allows you to set a cookie with various properties.
Cookie-name is the name of the cookie, cookie-value is the
data associated with the variable. Expires sets an
expiration date for the cookie, and must be in the format
'DD-Mon-YY HH:MM:SS', path sets the path for which
the cookie is valid, and secure specifies that the cookie is
only to be transmitted if the connection is secure (HTTPS).
headers redirect uri
- Redirect from the current page to a new URI. Must be done
in the first block of TCL code.
headers set headername value - Set arbitrary
headernames and values.
dtcl_info
- returns information on the internals of the module.
Currently, only the PID and size of the object cache are
reported.
FEATURES:
Important: because mod_dtcl uses namespaces, it doesn't clean up file descriptors after each page:
If you are using a Tcl package such as tcl-sql, where the package itself maintains some state, you must be *very strict* about releasing resources (e.g. closing files and DB connections) when your .ttml page is done. This is because the .ttml file isn't a standalone process, and therefore you cannot assume that resources will be released "on exit".
If you don't clean up, you can get some (apparently) intermittent behaviour with the Apache child process dying!