[dancer-users] Splat pollution of params' space

damien krotkine dkrotkine at gmail.com
Wed Dec 26 21:31:08 GMT 2012


Hi,

I think this is due to this line :

https://github.com/PerlDancer/Dancer/blob/devel/lib/Dancer/Route.pm#L139

And I don't know the rational for this feature. I don't think we need to
pollute the request params with splat, so I vote for its removal. Of course
in theory it breaks backward compatibility, so caution must be applied...
Anyone ever used $params->{splat} ? I think the splat() function can be
used instead in every cases.



On 26 December 2012 21:33, <alois.mahdal.1-ndmail at zxcvb.cz> wrote:

> Hello dancers!
>
> I like Dancer but I'm having a little problem with this
> regex/wildcard matching.  The issue is that hash returned
> by params() in the relevant sub always contains 'splat'
> key referring to array of matches.
>
> Maybe this reference might be useful (when?), what if
> I *really* want to pass "splat=splosh"?  According to
> my testing, the value is lost!
>
>
> Can this behavior be disabled?
>
> Or is it a bug?  (IIUC, I can always do `[ splat ]` so why
> the pollution?)
>
>
> For illustration, request is:
>
>      GET /there?splat=splosh&bar=baz
>
> and relevant route:
>
>      get qr{(.*)} => sub {
>          my $params  = params();
>          my ($path)  = splat;            # '/there'
>          my $foo     = $params->{foo};   # 'bar'
>          my $splat   = $params->{splat}; # [ '/path' ] instead
>                                          # of 'splosh'!
>          my $splat   = param('splat');   # '/there'
>      }
>
>
> Thanks,
> aL.
>
> --
> Alois Mahdal
> ______________________________**_________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/**mailman/listinfo/dancer-users<http://lists.preshweb.co.uk/mailman/listinfo/dancer-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20121226/57414fef/attachment-0001.htm>


More information about the dancer-users mailing list