[dancer-users] Retrieving params of fields with multiple values

Andrew Beverley andy at andybev.com
Fri Aug 22 18:18:41 BST 2014


On Fri, 2014-08-22 at 13:25 +0100, Aaron Crane wrote:
[...]
> That said, I do understand why someone would want to be able to get a
> list of all the values for a given parameter name. Instead of changing
> the predictable behaviour of param(), I'd suggest adding a new routine
> that does precisely what you want, perhaps along these lines:
> 
> sub param_list {
>     my ($name) = @_;
>     croak "param_list() must be called in list context"
>         if !wantarray;
>     my $value = param($name) // [];
>     return ref $value eq 'ARRAY' ? @$value : $value;
> }

+1 from me - that would be really useful.

Should I raise an issue/pull request?

Thanks,

Andy




More information about the dancer-users mailing list