Websh can send output to any Tcl channel and to global variables (web::put). Optionally, data is scanned for Tcl code before it is output to a channel (web::putx). Websh manages response objects that are related to Tcl channels and are identified using the name of the corresponding Tcl channel. Configuration is achieved with web::response.
Subcommands are -select, -set, -lappend, -names, -count, -unset, -reset, and -resetall Options are -sendheader, -httpresponse, and -bytessent.
Selects the default response object and sets and accesses properties of the response object, and returns the name of the response object.
Example 7. web::response
% web::response stdout % web::response -select stderr stdout % web::response stderr % web::response -sendheader 1 % web::response -names Content-Type Generator % web::response Content-Type text/html % web::response -bytessent 0 % web::response -set Set-Cookie "my cookie that contains data" % web::put "Hello, world\n" Content-Type: text/html Set-Cookie: my cookie that contains data Generator: websh3.00 (c) Netcetera AG, http://netcetera.ch Hello, world %
Send output to a Tcl channel. No newline is added to output. If ?channel? is ommitted, output is sent to the current default channel. The default channel can be changed with web::response -select ?#?channel. The optional hash ("#") denotes that output should be sent to a global variable named channel instead of a Tcl channel.
Writes text to the specified channel. Code in curly brackets is eval'd, unless the brackets are escaped by "\". These markup characters '{...}' can be changed to '<? ... ?>' with 'web::config putxmarkup tag'. The optional hash ("#") denotes that output should be sent to a global variable named channel instead of a Tcl channel.
Like web::putx, but takes input from a file.
Returns 0 on success, 1 otherwise. If an error occurs, an error message is written to msg. If only two arguments are passed, then channel takes precedence. The optional hash ("#") denotes that output should be sent to a global variable named channel instead of a Tcl channel.