sub thing { my $self = shift @_; croak "Incorrect number of arguments" if @_ % 2; my %arg = @_; for (@known_args) { # handle $arg{$_}; delete $arg{$_}; } if (keys %arg) { my $bad = join ' ', keys %arg; croak "The following args are invalid: $bad"; } # ... remainder of thing }
Cheers - L~R
In reply to Re^2: oop + named arguments
by Limbic~Region
in thread oop + named arguments
by nmerriweather
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |