http://qs321.pair.com?node_id=469105


in reply to Predefining sub Parameters

This is built in to perl6. In perl5, use Params::Validate. The one thing you'll notice has really changed is that @array_param is now passed as a reference. You can't just say func( "...", @ary, ... ) and have @ary passed as a distinct value without doing some really nasty things. That is, prototypes. You really, really don't want to use them in perl5. They were a mistake to have included (except maybe the & prototype) in perl at all.

functionname( "...", \ @bar, "..." ); use Params::Validate ':all'; sub functionname { my ( $string_param, $array_param, $other_string_param ) = validate_pos( @_, { type => SCALAR }, { type => ARRAYREF }, { type => SCALAR } ); }