Subject: | req vs opt named parameters when using aliases |
Error: "a required parameter cannot follow an optional parameter at /
home/signinr/perl/Params/Smart.pm line 138"
The documentation doesn't really describe the behavior, but apparently
the use of an alias removes the required attribute from a parameter.
Thus a sequence of 'required' parameters when one in the middle has an
alias will cause the entire parse to fail and croak with a mysterious
error.
Example:
@template = (
{
name => 'first',
required => 1,
},
{
name => 'second|2nd',
required => 1,
},
{
name => 'third',
required => 1,
});
Will cause a croak because the second parameter has its required
attribute removed, and the third parameter is required thus failing the
libraries check for this behavior.