Forum Discussion
Chris_Phillips
Aug 03, 2006Nimbostratus
Scoping variables
Hi,
I had a thread recently which lead to this wiki entry http://devcentral.f5.com/wiki/default.aspx/iRules/DestinationSnatUsingDNS.html and one instance of this iRule works fine, however as every variable used there is global, another instance requires the change of every variable name involved, otherwise they overwrite each other. This is obviosuly fairly horrible, yet if we define the variable within the RULE_INIT block that variable is lost outside of there once its completes its execution.
is there a nicer way that somehow falls inbetween these two situations?
Thanks
Chris
- Colin_Walker_12Historic F5 AccountWell, it appears as though the only variable in that example that truly needs to be defined globally is the count variable. Since the rest are statics, they could be set for just that particular iRule, and things would be fine.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects