At 05:41 AM 11/4/01, brian moseley wrote:
>On Sat, 3 Nov 2001, Dave Rolsky wrote:
>
> > Or even better:
> >
> > my $self = shift;
> > my %params = validate( @_, { ... } );
> >
> > using Params::Validate, which will handle defaults and
> > all that goodness.
>
>once you start talking about validating method parameters, i
>think the performance issue of using shift or copying @_
>kind of goes away eh?
But if everyone writes their methods as
my $self = shift;
my %params = @_;
then adding the validate or taking it away becomes much easier. It means a
skeleton already exists for one thing or another.
One thing I would mention is that I feel quite strongly that even if you do
named parameters, as early as possible in the method, they need to be
converted to real variables anyway... ie my $car = $params{'car'} because
named parameters have a horrid tendency to be typoed. At least for me, this
is usually my number one subtle error that I introduce into named parameter
code.
__________________________________________________
Gunther Birznieks ([EMAIL PROTECTED])
eXtropia - The Open Web Technology Company
http://www.eXtropia.com/