From: Daniel Westermann-Clark Date: Tue, 18 Apr 2006 07:49:43 +0000 (-0400) Subject: Simplify arguments X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=681fb87d8e1a2a2e47f120efb5c7ca0a6b3a327c;p=dbsrgits%2FDBIx-Class-Historic.git Simplify arguments --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 51541da..1963b61 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -304,8 +304,8 @@ L. =cut sub find { - my ($self, @vals) = @_; - my $attrs = (@vals > 1 && ref $vals[$#vals] eq 'HASH' ? pop(@vals) : {}); + my $self = shift; + my $attrs = (@_ > 1 && ref $_[$#_] eq 'HASH' ? pop(@_) : {}); # Parse out a hash from input my @unique_cols = exists $attrs->{key} @@ -313,15 +313,15 @@ sub find { : $self->result_source->primary_columns; my %hash; - if (ref $vals[0] eq 'HASH') { - %hash = %{ $vals[0] }; + if (ref $_[0] eq 'HASH') { + %hash = %{ $_[0] }; } - elsif (@vals == @unique_cols) { - @hash{@unique_cols} = @vals; + elsif (@_ == @unique_cols) { + @hash{@unique_cols} = @_; } else { # Hack for CDBI queries - %hash = @vals; + %hash = @_; } # Check the hash we just parsed against our source's unique constraints