Problems with globals?
"Molek, Gordon" <[email protected]> Wed, 30 Jul 2003 07:58:32 -0500
| Newsgroups | gmane.comp.web.tclwebtest |
|---|---|
| Message-ID | <[email protected]> |
Hi, it's me again. :-)
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?
Thanks,
Gordon Molek
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01