Forum Discussion
hooleylist
Aug 06, 2009Cirrostratus
You could test this pretty easily:
when HTTP_REQUEST priority 1 {
This will trigger a runtime TCL error as the variable doesn't exist
log local0. "\$non_existent_variable: $non_existent_variable"
Comment out the above and set the variable in this event
set non_existent_variable "now exists!"
}
when HTTP_REQUEST priority 2 {
This will work now
log local0. "\$non_existent_variable: $non_existent_variable"
}
does that make sense? Does the Tcl interp "chain" events together, executing each event independently in a seperate namespace in order of priority, or does it concatenate them all and execute them under the same namespace?
I think each event on the same virtual server is chained together in order of priority under the same namespace.
Obviously, local variables set in each event probably aren't transferrable - that is, I can't access $somevar under a HTTP_RESPONSE event unless it was global when it was declared. But events of the same type fired sequentially.. what happens then?
As cmbhatt said, yes, you can access a local variable across the same TCP connection in different events as long as the event you're referencing the variable in occurs after the local variable was set.
Aaron