I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2006-12-06 08:01:06-08 by gaetan
Params::Validate with attribute and default value
Hello Dave (and all !) I am using the Param::Validate module using the attribute option. There is a bug when using this module with the default values:
sub foo :method :Validate(bar => {default => "")) { <snip> }
This code will not work I modified the Attribute::Params::Validate package (line 67 and following)
$code .= "my \@param;\n"; if ($type eq 'named') { $code .= " my \%param = Params::Validate::validate(\@_, \$params);\n \@param = \%param;\n"; } else { $code .= " \@param = Params::Validate::validate_pos(\@_, \@p);\n"; } $code .= " unshift \@param, \$object if \$object;\n" if $is_method; $code .= <<"EOF"; \$referent->(\@param);
And it works ;-) Could it be integrated in the official package ? Remark: I am not a specialist of Perl internals, and I think my patch is not optimal (in particular the initialization @param = %param); Thanks Gaetan
Direct Responses: Write a response