Default setting doesn't working and so it is not an alternative for
Params::Validate in productive Systems. Also the package is named
Params::Validate::Dummy and not Params::Validate.
Maybe I can't understand the howto of this module, then excuse me.
Params::Validate::Dummy ':all';
sub mysub {
my ($scalar, $hashref) = validate_pos(
@_,
{type => SCALAR},
{type => HASHREF}
);
%$hashref = validate_with(
params => $hashref,
spec => {
key => {
type => SCALAR,
},
key_optional => {
type => SCALAR,
optional => 1,
default => 'default value for optialal key',
},
},
called => '2nd Parameter hashref',
);
return $hashref->{key_optional};
}
# return value is now undef and not 'default value for optialal key'
like Params::Validate.