You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-user@tcl.apache.org by Christoph Scheurer <ch...@ch.tum.de> on 2004/04/01 20:43:52 UTC
example for web::putxfile # channel ...
Hello,
I am trying to use the command web::putxfile with the option to write the
parsed template to an environment variable instead of a Tcl channel. I
would like to do something like the following:
web::putxfile # page file
web::response -set ContentLength [string len $env(page)]
web::put $env(page)
but I can not get it to work. It fails with the error
can't read "env(page)": no such variable
Does anybody have a working example?
Thanks in advance,
Ch. Scheurer
--
Christoph Scheurer
contact: http://www.theo.chemie.tu-muenchen.de/homepages/scheurer/
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-user-help@tcl.apache.org
Re: example for web::putxfile # channel ...
Posted by Andrej Vckovski <an...@netcetera.ch>.
On Thu, 1 Apr 2004, Christoph Scheurer wrote:
> Hello,
>
> I am trying to use the command web::putxfile with the option to write the
> parsed template to an environment variable instead of a Tcl channel. I
> would like to do something like the following:
> web::putxfile # page file
> web::response -set ContentLength [string len $env(page)]
> web::put $env(page)
> but I can not get it to work. It fails with the error
> can't read "env(page)": no such variable
web::putxfile #env(page) file
will work. (1. the variable name must immediatly follow the #, 2. the
word following the # is a Tcl variable name (not a environment
variable name), so to acess the process' environment you need to
specify env(page) instead of page if that's what you really want.)
otherwise do:
web::putxfile #page file
web::put $page
also:
keep in mind that web::putxfile will -- as a side effect -- output the
headers into env(page) (so you don't have to set the COntentLength
header) unless you prevent this.
- Andrej.
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-user-help@tcl.apache.org