If you're actually doing CGI programming in Tcl, you might also want to take a look at a couple of packages that simplify handling things like this. The standard Tcl distribution now includes something called The Standard Tcl Library, or
tcllib, which is a collection of useful utilities including:
[ul][li]Simple CGI interaction[/li][li]FTP interaction[/li][li]POP3 interaction[/li][li]NNTP interaction[/li][li]Command-line argument parsing[/li][li]Code profiling[/li][/ul]
Recent version of Tcl include
tcllib in the installation. You can download it separately from
Unfortunately, the documentation for the packages included in
tcllib can be a bit sketchy, but it should be enough to get you going. (If the version of
tcllib installed on your system doesn't include documentation -- as was the case with version 0.6 -- download and install the latest version from the URL given above).
To accomplish what you originally asked for above (assuming that your script is being executed as a CGI script), you can use the following code:
Code:
# Load the ncgi package
package require ncgi
# Parse the query information
ncgi::parse
# Get the value you want
set val [ncgi::value you]
A more full-featured CGI package is Don Libes'
cgi_tcl. You can find out more information about it and download it from
In addition to the information about the package provided there, there is a chapter about
cgi_tcl in the the book
Web Tcl Complete by Steve Ball. - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax