From: Matt S Trout Date: Tue, 4 Sep 2018 01:39:42 +0000 (+0000) Subject: rearrange hashpair expansion X-Git-Tag: v1.90_01~483 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ef071fade9e19ee9721dd8eb8414914694632246;p=dbsrgits%2FSQL-Abstract.git rearrange hashpair expansion --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 03b5a93..1327193 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -552,21 +552,22 @@ sub _expand_expr { sub _expand_expr_hashpair { my ($self, $k, $v, $logic) = @_; - if (!ref($v)) { - if ($k !~ /^-/) { + if ($k =~ /^-/) { + if ($k eq '-nest') { + return $self->_expand_expr($v); + } + } else { + if (!ref($v)) { return +{ $k => { $self->{cmp} => $v } }; } - } - if ($k eq '-nest') { - return $self->_expand_expr($v); - } - if ($k !~ /^-/ and my $literal = is_literal_value($v)) { - unless (length $k) { - belch 'Hash-pairs consisting of an empty string with a literal are deprecated, and will be removed in 2.0: use -and => [ $literal ] instead'; - return \$literal; + if (my $literal = is_literal_value($v)) { + unless (length $k) { + belch 'Hash-pairs consisting of an empty string with a literal are deprecated, and will be removed in 2.0: use -and => [ $literal ] instead'; + return \$literal; + } + my ($sql, @bind) = @$literal; + return \[ $self->_quote($k).' '.$sql, @bind ]; } - my ($sql, @bind) = @$literal; - return \[ $self->_quote($k).' '.$sql, @bind ]; } return { $k => $v }; }