package require http
set tok [http::geturl http://localhost:1565/pgn4desk.htm]
upvar $tok token
set token(body) ""
parray token
However it results in the following error. I still haven't wrapped my
head around upvar :( Hopefully in the near future as I use Tcl more
and more. Thanks in advance for any guidance:
$ ./tclkit-cli pgn4desk.vfs/debug.tcl
bad level "::http::1"
while executing
"upvar $tok token"
(file "pgn4desk.vfs/debug.tcl" line 3)
# there is no level further up than (the current) toplevel scope thus
# upvar wants that optional level argument:
upvar #0 $tok token
set token(body) ""
parray token
#or
package require http
set tok [http::geturl http://localhost:1565/pgn4desk.htm]
set ${tok}(body) ""
parray $tok
uwe
Note that the confusing error message
bad level "::http::1"
is now (8.6) replaced by the accurate
bad level "1"
since the root cause of the problem is the fact that, without an
explicit level, upvar assumes [upvar 1] (meaning one up), which here
is invalid as you said, since we're already at toplevel.
This message improvement was part of the fix for bug 2673163:
https://sourceforge.net/tracker/index.php?func=detail&aid=2673163&group_id=10894&atid=110894
-Alex