Other mod_dtcl Documentation
Internals
- Read the code!
-
Initialization
When Apache is started, (or when child Apache
processes are started if a threaded Tcl is used),
tcl_init_stuff
is called, which creates
a new interpreter, and initializes various things,
like the apache_channel
channel system.
The caching system is also set up, and if there is a
GlobalScript, it is run.
- Achan/apache_channel
The "Apache Channel" system was created so that it is
possible to have an actual Tcl channel that we could
redirect standard output to. This lets us use, for
instance, the regular "puts" command in .ttml pages.
It works by creating commands that write to memory
that is slated to be sent to the client.
- Page parsing/execution
In send_parsed_file
Each .ttml file is
loaded and run within its own namespace. No new
interpreter is created for each page. This lets you
share variables, and most importantly, loaded modules,
from a common parent (such as one of the InitScripts).
When a file is loaded, it is transformed into a Tcl
script by putting everything outside of <? and
?> into large hputs statements. When the script is
complete, it is then inserted into the cache, for
future use. In fact, if the file modification
information doesn't change, mod_dtcl will execute the
cached version of the script the next time it is
encountered.
- Binary data
mod_dtcl is capable of outputing binary data, such as
images, or loading binary data with 'include'.
Upgrading From Older (< 0.9.3) Versions
- New tags
As of version 0.9.4, mod_dtcl uses
<? and ?> instead of <+ and +> to delimit
sections of Tcl code. By default, dtcl is still compiled
with code to parse the <? ?> tags, but it will run
faster if USE_OLD_TAGS
is set to 0 in
mod_dtcl.h
. You can automatically change your
.ttml files to the new format by using the
newtags.sh
script in the contrib/ directory.
Run it at the top level of your DocumentRoot.
- headers setcookie
The headers setcookie
command now uses the
-name
and -value
flags for those
arguments, whereas this was not necessary in the past.