good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Multiple routes that execute the same actionby sundialsvc4 (Abbot) |
on Mar 28, 2014 at 12:33 UTC ( [id://1080080]=note: print w/replies, xml ) | Need Help?? |
Most of the time, the URL-matching algorithms (in any framework ...) allow you to specify regular-expressions of various sorts to specify the URLs that should invoke a particular subroutine. And, they usually allow for a list of regexes to be associated with any particular sub. That being said ... consider also that maybe the simplest and most obvious approach might be the best one: specify different subroutines for each URL pattern, and have each of them gather-up whatever parameters might be in their URLs (each in their own way), and then return the result of a call to a separate, common subroutine to handle the common behavior. To my way of thinking, this puts no real burden on the programmer, is perfectly clear, and graciously facilitates variations in the URL-layout without adding complexity or “coupling” one routine to another.
In Section
Seekers of Perl Wisdom
|
|