From: Matt S Trout Date: Tue, 26 Mar 2019 01:49:53 +0000 (+0000) Subject: clean up part of the arrayref stuff X-Git-Tag: v2.000000~3^2~343 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c71232ad68760b3edc8ac2858f4e456203f19c23;p=dbsrgits%2FSQL-Abstract.git clean up part of the arrayref stuff --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index b0c33f5..62da661 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -678,11 +678,10 @@ sub _expand_expr_hashpair_ident { ] }; } if (ref($vv) eq 'ARRAY') { - my ($logic, @values) = ( - (defined($vv->[0]) and $vv->[0] =~ /^-(and|or)$/i) - ? @$vv - : (-or => @$vv) - ); + my @raw = @$vv; + my $logic = (defined($raw[0]) and $raw[0] =~ /^-(and|or)$/i) + ? shift @raw : '-or'; + my @values = map +{ $vk => $_ }, @raw; if ( $op =~ $self->{inequality_op} or $op =~ $self->{not_like_op} @@ -703,10 +702,7 @@ sub _expand_expr_hashpair_ident { : $op =~ $self->{not_like_op} ? belch("Supplying an empty arrayref to '@{[ uc $op]}' is deprecated") && $self->sqltrue : puke "operator '$op' applied on an empty array (field '$k')"; } - return $self->_expand_op_andor($logic => [ - map +{ $vk => $_ }, - @values - ], $k); + return $self->_expand_op_andor($logic => \@values, $k); } if ( !defined($vv)