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

Yanick Champoux yanick at babyl.dyndns.org
Sat Aug 23 17:03:50 BST 2014


On 14-08-22 01:18 PM, Andrew Beverley wrote:
> 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.

Indeed, and Aaron speaks wisdom. Better have a new 'param_list' (or 
'param_array'?) and leave the current 'param' alone. That should makes 
everyone happy.

> Should I raise an issue/pull request?

Please do!

Joy,
`/anick



More information about the dancer-users mailing list