Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Adding regexps to named URI parameters aka /from/:foo/to/:bar - can it get better than this?

by Dallaylaen (Chaplain)
on Sep 11, 2017 at 09:27 UTC ( [id://1199074]=note: print w/replies, xml ) Need Help??


in reply to Re: Adding regexps to named URI parameters aka /from/:foo/to/:bar - can it get better than this?
in thread Adding regexps to named URI parameters aka /from/:foo/to/:bar - can it get better than this?

Thank you, roboticus.

Despite my post being a case of "rubber duck debugging", my duck didn't tell me anything, so I had no choice but to submit it.

Your answer was quite insightful though. I realized that if I used an actual regexp I would most likely use something like my ($foo, $bar) = $line =~ qr/.../; instead of named captures. I think I'll just add a method to extract unnamed captures from path_info.

As for the use cases, IMHO mapping fancy URLs to query parameters is not at all a framework's responsibility. A proxy should do it. However, Mojo and Dancer and Kelp have it and I have to match if I want to ever take off.

Thanks again.

  • Comment on Re^2: Adding regexps to named URI parameters aka /from/:foo/to/:bar - can it get better than this?

Replies are listed 'Best First'.
Re^3: Adding regexps to named URI parameters aka /from/:foo/to/:bar - can it get better than this?
by Anonymous Monk on Sep 11, 2017 at 12:42 UTC
    To match add dependency on standalone cpan module that does it
      Looks like Routes::Tiny does it. Hmmm, maybe I'll try it. Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1199074]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-19 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found