[ Previous ] [ Contents ] [ Index ] [ Next ]

Global Variables

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.

[ns/server/server-name/tcl]

Parameter

Default Value

Description

SharedGlobals

Off

Boolean value. Set to On to retain backwards compatibility with AOLserver Version 2.1, which used only one global variable table per virtual server.

If this parameter is Off, each Tcl interpreter will have its own global variable table, and a shared variable table will be used for variables global to all the interpreters for a virtual server. Use the ns_share Tcl command to make a variable global to all Tcl interpreters for a virtual server.

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:

[ns/server/server-name/adp]

Parameter

Default Value

Description

GlobalInclude

Off

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.

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.