Forum Discussion
The_Bhattman
Nimbostratus
Mar 05, 2008Does iRULES Support Boolean Short Circuit
Does iRules support Boolean short circuit like Perl does?
For example in Perl a short circuit would like the following
($cat eq "al") && (return "Alcohol");
Could there be something ...
hoolio
Cirrostratus
Mar 07, 2008TCL does support boolean short circuiting. So if the first test is anded with the second and the first one fails, the second test isn't attempted.
What are you trying to accomplish though? If it's better error handling, I think using 'catch' command would be more optimal.
I don't think the pool command will return any value if the pool exists so it wouldn't be valid boolean result. If the pool doesn't exist, you'll see a TCL error and the connection will be killed.
You can use syntax like that with iRules, but you'd need to keep in mind what the commands return as standard output.
For example this work to only try to decrypt a cookie if the value of the cookie has a length:
if {[string length [HTTP::cookie value $::my_cookie_name]] and [HTTP::cookie decrypt $::my_cookie_name $::my_cookie_passphrase] eq "my-site_[IP::client_addr]"}{
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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