Re: [tclwebtest] Another try, do_request and globals issues
Status: Abandoned
Brought to you by:
tils
From: Grzegorz A. H. <gr...@ef...> - 2003-08-18 09:12:17
|
On 2003-08-08, Gordon Molek <gor...@ea...> wrote: > Secondly, I am still having trouble with globals. [...] > > #! /cygdrive/c/tcl/bin/tclsh.exe > proc dumb_proc {} { > set myvar 4 > puts "The value of the local variable is $myvar" > > global myglobalvar > puts "The value of the global variable is $myglobalvar" > } > > set myglobalvar 79 > dumb_proc > > [...] Does tclwebtest do something that interferes with global > variables? [...] Yes it does. Basically the first thing you run is in the global namespace, `set myglobalvar 79' therefore sets a global variable. However, when you run the same script from tclwebtest, it's tclwebtest which is running in the global namespace, and your script is being run in another namespace because it is being run inside an `eval'. Maybe tclwebtest could be modified to run inside a custom namespace and then run the script with an `upvar' instead. Til, what do you think? Anyway, the solution to your problem is easy, before `set myglobalvar 79' put another `global myglobalvar' and it will work as expected: $ ./tclwebtest test ----- START: test at [18/ago/2003:10:57:59] ----- The value of the local variable is 4 The value of the global variable is 79 ----- SUCCESS: test (took 0s) ----- DURATION: 0 -- Grzegorz Adam Hankiewicz, gr...@ef.... Tel: +34-94-472 35 89. eFaber SL, Maria Diaz de Haro, 68, 2 http://www.efaber.net/ 48920 Portugalete, Bizkaia (SPAIN) |