In earlier releases of the AOLserver, global variables were shared between all Tcl interpreters in a virtual server. In Version 2.2, each Tcl interpreter has its own global variable table, so global variables are shared only within each Tcl interpreter by default. A new command, ns_share, has been added to allow you to make a variable available to all interpreters in a virtual server.
Global variables are flushed when the Tcl interpreter is deallocated. A Tcl interpreter is deallocated explicitly when Ns_TclDeallocateInterp is called or implicitly at the end of a connection. This allows Tcl filter functions to access global variables set in ADPs.
If you want to retain backwards-compatibility with Version 2.1, you can set the new SharedGlobals parameter to On in the [ns/server/server-name/tcl] section of the configuration file. If this is done, global variables will be shared between all Tcl interpreters in a virtual server, and ADP parsing will not have "page-scope" variables.
For ADPs, you can specify whether Tcl in ADPs run with ns_adp_parse or ns_adp_include will be evaluated at the local or the global level with the GlobalInclude parameter:
Boolean value. Set to On to specify that Tcl in ADPs run with ns_adp_parse or ns_adp_include will be evaluated at the global level. If this parameter is Off, Tcl in ADPs will be evaluated locally. |