Forum Discussion
Deb_Allen_18
Feb 22, 2006Historic F5 Account
Referencing a class with a variable
I'm wondering if I can reference a class with a variable?
Will the class reference below evaluate to $::myclass?
when HTTP_REQUEST {
set uri_discards myclass
if {[matchclass [HTTP::uri] starts_with $::{$uri_discards}]}{
discard
}
}
I also noticed that I don't get any errors loading up this rule, even though neither class "myclass" nor "uri_discards" exists, so I'm wondering how much classname verification I might need to perform using variables in this manner?
thanks
/deb
4 Replies
- Colin_Walker_12Historic F5 AccountThere's actually a tech tip about dynamically declaring class names here: Click here
Check it out and let us know if you've got any further questions.
Thanks,
-Colin - Deb_Allen_18Historic F5 Accountsweet, thanks!
so using eval against the findclass command results validates the cookie value for its intended use - finding the related pool or branching elsewhere if not found:
I take it there's no graceful way to do it without setting the 2 variables? - JCohenRet. EmployeeColin,
The link in this post is broken? Getting access denied viewing tab. Does this article still exist? Is it still relevant?
Jason - hoolio
Cirrostratus
Hi Jason,
This is the article Colin was referring to:
Dynamically declaring a class name based on Request info
http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=37
I think you might be able to use subst as well:
TCL subst man page
http://www.tcl.tk/man/tcl8.4/TclCmd/subst.htm
Examples:
http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=23503&ptarget=23562
Aaron
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
