You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The storage that contains parameters has two special keys: splat and capture. If you create a named placeholder using one of those names, it confuses the internal system, and the keywords splat and captures will assume there are captures or unnamed placeholder variables.
# Confuses the splat() keyword
get '/:name/:id/:splat'=>sub {...};
# Confuses the captures() keyword
get '/:name/:id/:captures'=>sub {...};
To avoid such confusion, we will simply not allow these named placeholders.
Benefits to Dancer2 codebase
While it was not the best decision to use the same top-level storage for both named placeholders, captures, and splats - leading to this issue - deprecating this allows us to be certain of the consistency of results in the core code and not have to worry about odd situations we need to debug in the future.
Benefit to Dancer2 Community
While this seems like a minor limitation (such a case was never reported), it might reduce the confusion when accidentally mixing named placeholders with keywords for non-named placeholders or regular expression captures.
Alternatives
Regular expressions still support named captures and have no limitations on Dancer2's side:
Why?
The storage that contains parameters has two special keys:
splat
andcapture
. If you create a named placeholder using one of those names, it confuses the internal system, and the keywordssplat
andcaptures
will assume there are captures or unnamed placeholder variables.To avoid such confusion, we will simply not allow these named placeholders.
Benefits to Dancer2 codebase
While it was not the best decision to use the same top-level storage for both named placeholders, captures, and splats - leading to this issue - deprecating this allows us to be certain of the consistency of results in the core code and not have to worry about odd situations we need to debug in the future.
Benefit to Dancer2 Community
While this seems like a minor limitation (such a case was never reported), it might reduce the confusion when accidentally mixing named placeholders with keywords for non-named placeholders or regular expression captures.
Alternatives
Regular expressions still support named captures and have no limitations on Dancer2's side:
However, we still view "splat" and "captures" as confusing names to give your path matches since they are also keywords for path matches.
The text was updated successfully, but these errors were encountered: