Forum Discussion
Scope of variables when using call
- Dec 05, 2022
The proc does not inherit the variables from the caller. It will inherit all static variables and functions eg HTTP::path, but there are two ways to allow these variables in the procedure - either send them as calling variables, or use upvar.
Sending them as variables is more dependable - you don't need to worry about naming or suchlike but you can end up sending a lot of information. Add this to the procedure eg
proc process_URL {var1 var2 var3 {optionalvar "default value"} } { ... }
You can also only have a single variable but make it a list.
Upvar depends on naming of variables to import a specific variable into the proc scope. Very useful if you want to modify the original variable, but open to errors if the variable doesn't exist or suchlike
TCP::collect (Click here)
CLIENT_DATA (Click here)
HTTP::disable (Click here)
Aaron
Recent Discussions
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com