Replies: 2 comments 2 replies
-
I like this idea @xoid! I actually have a use case where I've got a site working off of a domain, and a subdomain of itself. The difference is very small, so I handle it with a 'before' hook to set a var if we're in the subdomain and just check for that var in the routes. But I can see the use case where you had radically different code, where a predicate like this would be useful; it would avoid potentially-large if-blocks in your code, which appeals to my sense of cleanliness, too. I have an idea how to do this as a plugin, and think I could have that ready for you to use later this week or this weekend. It would take a string or a regex, so you could do:
`` `Would something like that work for your use-case? |
Beta Was this translation helpful? Give feedback.
-
Success! I've posted the new plugin you suggested to PAUSE, and it should be available shortly on CPAN. This was a great idea, and fortunately not at all difficult to deliver. Please let me know via the Issues tracker on the repository if you find any problems. Thanks for being a part of our community, @xoid ! |
Beta Was this translation helpful? Give feedback.
-
Would be great to have host predicate to serve multiple domainnames:
get '/' => host 'my.host.com' => sub {do something};
Beta Was this translation helpful? Give feedback.
All reactions