On Tue, Jul 27, 2004 at 12:29:00AM -0400, Duane Beck wrote:
> Erick Calder wrote:
> 
> >I always prefer more flexibility so one thing I'd like to see is call
> >signatures that can take a hash or list of hashrefs so I can write:
> >
> >     $y = { three => 'tre' };
> >     $x->(one => 'ett', two => 'tva', $y, etc => 'whatever');
> 
> The following should work without any change.
> 
> $x->( one => 'ett', two => 'tva', %$y, etc => 'whatever' );

It's also saner inside &$x, where it can do

  my %stuff = @_;

rather than

  my %stuff;
  while (@_) {
    if (ref($_[0]) eq "HASH") {
      @stuff{keys %$_} = values %$_;
      shift;
    }
    elsif (@_ > 1) {
      $stuff{$_[0]} = $_[1];
      splice(@_, 0, 2);
    }
    else {
      croak "?SYNTAX ERROR in parameters";
    }
  }

or something.

-- 
Rocco Caputo - http://poe.perl.org/

Reply via email to