in reply to DWIM code would use Params::Validate
in thread Correct idiom for default parameters
Here's one reason not to use Params::Validate.
The code (minus the inline stuff), in Re: Inline Subs Revisited takes just over 4 1/2 minutes to run.
Modify those subs to validate their parameters using P:V like so:
sub max { validate_pos( @_, { TYPE => ARRAYREF } ); my ($list) = @_; my $max; for (@$list) { $max = $_ if ! defined $max || $_ > $max; } return $max; }
And it takes almost 22 minutes.
And achieves nothing that couldn't be done with die unless ref( $list ) eq 'ARRAY';. (That costs nothing measurable.)
Its like trying get better fuel economy by adding a large, copper-wound electric motor and 50Kg of batteries to your car.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DWIM code would use Params::Validate
by Anonymous Monk on Apr 30, 2010 at 09:46 UTC | |
by BrowserUk (Patriarch) on Apr 30, 2010 at 12:54 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |