fc2 tcl problem?
Georgios Petasis
petasisg at yahoo.gr
Mon Jun 28 22:34:52 UTC 2004
I am particularly worried about the statement:
upvar #0 ::env cgi::env
I think there is an error in this statement, as
its executed from the cgi::data proc, and tries
to create a variable named cgi::cgi::env, thus
raising an error. (I think this is the problem, though
I haven't tried to run the code...)
The solution is to simply use:
upvar #0 ::env env
which will make equivalent the env variable in the global
scope with the env variable in the proc (which in turn
is linked to the ::cgi::env variable through the variable statement).
I think :-)
George
----- Original Message -----
From: "Luciano Miguel Ferreira Rocha" <strange at nsk.no-ip.org>
To: <fedora-list at redhat.com>
Sent: Monday, June 28, 2004 11:43 PM
Subject: fc2 tcl problem?
>
> Hello,
>
> The following code:
>
> package provide cgi 2.0
>
> namespace eval cgi {
>
> variable Channel stdin ;## channel for reading data
> variable Field ;## variables o CGI communication (array)
> variable Red 0 ;## Is data red?
> variable Cookie ;## cookies array
> variable Type ;## Types for eacg CGI variable (array)
> variable Mime text/plain ;## MIME type of last request
> variable BUFFER_SIZE 500000 ;## maximum bytes in multipart upload
> variable env ;## environment for executing cgi
>
>
> variable TMP /var/tmp ;## directory of temporary files (upload)
> variable TIMEOUT 2000 ;## timeout or reading message (POST)
> variable STEP 100 ;## time between reading attempts (POST)
>
> namespace export start ;## processes CGI using argument
> namespace export state ;## processes cooies using argument
> namespace export field ;## returns field value
> namespace export cookie ;## returns field value
>
> namespace export url_encode ;## Encode argument in URL
> namespace export url_edecode ;## Decode argument in URL
> namespace export url_encode_state ;## Encode state of CGI variables
>
> }
> ...
> ## Read data from CGI communication
> proc cgi::data {} {
> variable env
> variable Red
>
> if $Red return
>
> upvar #0 ::env cgi::env ;# use process environment
>
> if { [ info exists env(CONTENT_TYPE) ] } {
>
> switch -regexp -- $env(CONTENT_TYPE) {
> multipart/form-data { multipart }
> application/x-www-form-urlencoded { urlencoded }
> default { urlencoded }
> }
> } else {
> urlencoded
> }
>
> set Red 1
> }
>
> Causes the error:
> 2004/06/28 19:18:02 ??: can't create "cgi::env": parent namespace doesn't
> exist:
>
> when TCL from FC2 (tcl-8.4.5-7) or rawhide (tcl-8.4.6-2) is used, but
works
> well with the last update to FC1 (tcl-8.3.5-96.0.1).
>
> Can anyone that knows more than I about tcl if this is a bug in tcl
> itself, and that I should report it to bugzilla, or if it's a bug in the
> application, and give some pointers on how to correct it?
>
> Thanks,
> Luciano Rocha
>
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
>
More information about the fedora-list
mailing list