in reply to Re: named arguments
in thread named arguments

I designed the named parameters to start with a '-' in our current project---biggest mistake I could make.

sub foo { my ($self, $params) = __params({ -a => '...', }, \@_); ... if ($params->{a}) {
You see the mistake above? Happend all the time, until I was forced to add this to __params():

foreach my $key (keys %$result) { my $tkey = $key; $tkey =~ s/^-//; $result->{$tkey} = $result->{$key}; } return $result; }

Search, Ask, Know