Version 10 of ncgi

Updated 2010-01-14 07:41:05 by booksandlibros

The ncgi package provides commands that manipulate CGI values. These are values that come from Web forms and are processed either by CGI scripts or web pages with embedded Tcl code. Use the ncgi package to query these values, set and get cookies, and encode and decode www-url-encoded values. (From the man page [L1 ])

Documentation can be found at http://tcllib.sourceforge.net/doc/ncgi.html


Undocumented, but fairly important, is the need to call ::ncgi::header (or ::ncgi::redirect) after ::ncgi::setCookie, else the cookie does not set. Jan. 13, 2010

#!/usr/bin/env tclsh8.4
package require ncgi
::ncgi::setCookie -name test -value THisIsAGoodCookie -domain didgood.com -expires "july 20, 2010" -path /
::ncgi::parse
#NOTE: Must use ncgi::header else cookie never sets.
#puts "Content-Type: text/plain\n"
::ncgi::header

puts "cookie: [::ncgi::cookie test]"

recently on comp.lang.tcl, aku mentioned that ncgi came about by starting with Don Libes' cgi.tcl extension and breaking the code into namespaces and 3 modules.

Related modules in tcllib are


Category Package, subset Tcllib