Dtcl-tcl

dtcl.tcl is a subset of Don Libes' great cgi.tcl package, ready for use with mod_dtcl .ttml pages.

Every command in cgi.tcl that is included in dtcl.tcl, works like in cgi.tcl[1]. All existing cgi.tcl scripts that use only that command set provided by dtcl.tcl should work, with only a few changes, as a .ttml page.

cgi.tcl is reasonably complete and powerful. There are a couple of things that are currently not possible with mod_dtcl, that can easily be done with cgi.tcl within a normal cgi environment: cookies, http header manipulation, file upload, and multiple files. The cgi.tcl commands related to these functions have been removed[2].

All the html creation helper functions (including table and form support) and the mail ability are there and should work as you would expect.

To enable dtcl.tcl within your .ttml pages just include a line similiar to:

GlobalScript (path to)/dtcl.tcl

into your httpd.conf.

Cgi tcl scripts, that depend only on the cgi.tcl features provided by dtcl.tcl, as, for example, a lot of the example scripts that come with the cgi.tcl distribution, are easily transformed to .ttml pages. Just rename them to .ttml and inserte "<* before everything else and "+>" at the end.

(Please note that a simple 'puts "some string"' within a .ttml page doesn't do what you probably expect. Even Don has used some 'puts' statement within his examples, instead of cgi_puts. Just rename this puts to cgi_puts or insert something like:

  
proc putsWrapper {args} {
    switch [llength $args] {
	1 {hputs "$args"}
	2 {core_puts [lindex $args 0] "[lindex $args 1]"}
	3 { 
	    if {[lindex $args 0] == "-nonewline"} {
		core_puts [lindex $args 0] [lindex $args 1] [lindex $args 2]
	    } else {
		hputs "bad argument \"[lindex $args 0]\": should be \"\
			-nonewline\""
	    }
	}
	default { core_puts "wrong # args: should be \"puts \
		?-nonewline? ?channelId? string\""; return break}
    } 
return 0
}
rename puts core_puts
rename putsWrapper puts
      

at the end of dtcl.tcl.)

Of course, it's perfectly OK to intermix the dtcl.tcl commands with html, just as you would do on normal .ttml pages. Just avoid the commands cgi_html, cgi_head and cgi_body, if the corresponding HTML tags are within your HTML code.

New user interface commands:

cgi_permanent_admin_mail_addr

Sets the default administrator's mail address. For a single page you can change this with cgi_admin_mail_addr (address).

cgi_permanent_mail_addr

Sets the default 'from' mail address, used in ttml pages . For a single page you can change this with cgi_mail_addr.

cgi_skeleton_outside_tcl

If you're intermixing HTML and tcl and you will use the error cache and administrator notification ability of cgi_eval, call this command before the first cgi_eval call. This doesn't guarantee valid HTML code in error case but it suppresses at least silly <head> and <body> tags.

[1] Thats not exactly true. More precisely:

[2] The complete list of the removed commands (a few are only internal, not user interface):

Dtcl.tcl was created by Rolf Ade (rolf@storz.de), by modifying Don Libes' cgi.tcl.