[tclwebtest] Another try, do_request and globals issues
Status: Abandoned
Brought to you by:
tils
From: Gordon M. <gor...@ea...> - 2003-08-08 11:58:41
|
Distinguisehd members of the tclwebtest-general list. I am going to try using a different e-mail address to see if this one allows me to properly respond to messages, so thanks for your patience. First, thanks to everyone for the responses to my "can't do_request" inquiry. For whatever reason, it seems to have cleared up as I am now able to receive the contents of arbitrary dotted decimal address URLs. Secondly, I am still having trouble with globals. From my previous posting, the problem is: I was trying to develop a link-walk algorithm to validate that all the links on a web-site were valid and recursion combined with a list of already visited links appeared to be the way to implement it. However, I can't seem to use globals within tclwebtest. Here's a dumb TCL script which I found on a web site somewhere that illustrates global variables: #! /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 As expected, when run, it produces the following output: $ ./global.tcl The value of the local variable is 4 The value of the global variable is 79 However, if I try to run it using tclwebtest (without the "#! /cygdrive/c/tcl/bin/tclsh.exe" line, I get the following: $ ../tclwebtest global.test ----- START: global.test at [30/Jul/2003:07:52:51] ----- The value of the local variable is 4 can't read "myglobalvar": no such variable while executing "puts "The value of the global variable is $myglobalvar"" (procedure "dumb_proc" line 6) invoked from within "dumb_proc" (file "global.test" line 10) invoked from within "source global.test" ("uplevel" body line 3) invoked from within "uplevel $uplevel $to_eval " in "global.test" line 10: puts "The value of the global variable is $myglobalvar" } set myglobalvar 79 dumb_proc ----- FAILED: global.test (took 1s) ----- DURATION: 1 1 of 1 tests FAILED: global.test Does tclwebtest do something that interferes with global variables? I have also played around with upvar with the following test: proc dumb_proc {} { set myvar 4 puts "The value of the local variable is $myvar" upvar "#0" myglobalvar mylocalvar puts "The value of the global variable is $mylocalvar" set mylocalvar 69 } set myglobalvar 79 dumb_proc puts "The value of the global variable is now $myglobalvar" Which generates the following errors: ----- START: upvar.test at [08/Aug/2003:06:55:55] ----- The value of the local variable is 4 can't read "mylocalvar": no such variable while executing "puts "The value of the global variable is $mylocalvar"" (procedure "dumb_proc" line 6) invoked from within "dumb_proc" (file "upvar.test" line 11) invoked from within "source upvar.test" ("uplevel" body line 3) invoked from within "uplevel $uplevel $to_eval " in "upvar.test" line 11: set mylocalvar 69 } set myglobalvar 79 dumb_proc ----- FAILED: upvar.test (took 0s) ----- DURATION: 0 1 of 1 tests FAILED: upvar.test Again, when run under "straight" TCL it works as expected: $ ./upvar.tcl The value of the local variable is 4 The value of the global variable is 79 The value of the global variable is now 69 Thanks in advance, Gordon Molek |