megasplat and named tokens do not work together. #742

Closed
ambs opened this Issue Feb 11, 2012 · 4 comments

4 participants

@ambs
PerlDancer member

Was trying to write this:

   get '/get/:type/**' => sub {

but then,

[8675]  core @0.000794> [hit #1]trying to match `/get/foo/pictures/1134-1280x1024.jpg' against /^\/view\/(?#megasplat)([^
]+)\/(?#splat)([^\/]+)$/ in /Library/Perl/5.12/Dancer/Route.pm l. 84
[8675]  core @0.000999> [hit #1]trying to match `/get/foo/pictures/1134-1280x1024.jpg' against /^\/get\/([^\/]+)\/(?#megasplat)([^
]+)$/ in /Library/Perl/5.12/Dancer/Route.pm l. 84
Use of uninitialized value within @splat_or_megasplat in pattern match (m//) at /Library/Perl/5.12/Dancer/Route.pm line 96, <DATA> line 16.
@Relequestual

If the fix for this isn't going to be merged in, then the documentation should be updated respectfully. Shall I make a PR for a doc change?

@sukria
PerlDancer member

It makes sense. I think that regarding Dancer1's frozen-policy, the right way to go is to document that as a limitation of Dancer1, and suggest moving to D2 if this is a need.

Hence I'd vote for a documentation update.

@bigpresh is the Dancer1's release manager now, so his opinion on this is will be interesting to hear.

@bigpresh
PerlDancer member

Looking at the PR-1086, it seems that this is a current bug, and that the PR provides a well-written fix with tests, so I'd be in favour of merging it and getting it in the next release - I'm happy to make that happen soon once I've reviewed it in a little more detail.

@veryrusty veryrusty added a commit that closed this issue Oct 26, 2015
@veryrusty veryrusty Allow mixed named params and splats in route captures
Allows route definitions with mixed token (param), splat and megasplats,
such as get '/some/:id/**/*' => sub {};.

To solve param/token/splat ordering, all (compiled) captures are now
tagged with regex comments (previously only splat and megasplat were
tagged with comments). These are extracted and values iterated over
so we can assign a captured value as a token or a splat.

Closes #742.
6dac8d8
@veryrusty veryrusty closed this in 6dac8d8 Oct 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment