-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
"Use of uninitialized value $_ in split at ... Route.pm" when using optional megasplat #1144
Comments
Sorry for the massive delay responding to this. I'll try to rock up a test to reproduce it, and get a fix in place. |
No worries at all. Ended up working round it by not actually needing to use megasplat. |
Yeah, able to reproduce against current master, simple test app that defines a route
|
Nice. I wonder if the same bug exists in D2. |
This fixes issue #1144. If you had a route with an optional megasplat, for example: ```perl get '/foo/?**?' => sub { ... }; ``` and you called it as `/foo`, you'd get a warning: ``` Use of uninitialized value $values[0] in split at /home/davidp/dev/github/Dancer/lib/Dancer/Route.pm line 136. ``` This fixes it. However you will still get an empty arrayref. Part of me would prefer it return undef instead of an empty arrayref in this case, but that would be changing existing behaviour which apps in the wild may be relying upon, so it' probably safest to maintain the same behaviour and just squash the warning.
This is the same bug reported in D1 as PerlDancer/Dancer#1144 - the bug was also present in D2. The D1 fix was in commit PerlDancer/Dancer@a5e54dc
This bug does indeed exist in D2. I've PR'd a fix for both :) Thanks again for the report! |
Skills! Especially given the time of day! Falling asleep myself! |
When creating a route that uses an optional megasplat, and then accessing the route without the optional parts, warning thrown
Use of uninitialized value $_ in split ..... Route.pm line 96.
Dancer version 1.3202
I'd like to be able to create a test which shows this, however I am unable to install the Safe module on osx, which is an auther dependency.
Example route:
/API/users/?**?
The text was updated successfully, but these errors were encountered: