|
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 |