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 } ); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Predefining sub Parameters
by willyyam (Priest) on Jun 22, 2005 at 18:51 UTC | |
by Tanktalus (Canon) on Jun 22, 2005 at 23:30 UTC | |
by willyyam (Priest) on Jun 23, 2005 at 13:22 UTC | |
by diotalevi (Canon) on Jun 24, 2005 at 05:02 UTC |
In Section
Seekers of Perl Wisdom