From: Matt S Trout Date: Tue, 18 Sep 2018 01:15:43 +0000 (+0000) Subject: only maybe list expand if <1 thing X-Git-Tag: v2.000000~3^2~446 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7f49b7cd8494b79674392abc06442cc721eea918;p=dbsrgits%2FSQL-Abstract.git only maybe list expand if <1 thing --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 583a1c5..126fc7a 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -1112,11 +1112,17 @@ sub _table { sub _expand_maybe_list_expr { my ($self, $expr, $logic, $default) = @_; - return ref($expr) eq 'ARRAY' - ? { -op => [ + my $e = do { + if (ref($expr) eq 'ARRAY') { + return { -op => [ ',', map $self->_expand_expr($_, $logic, $default), @$expr - ] } - : $self->_expand_expr($expr, $logic, $default); + ] } if @$expr > 1; + $expr->[0] + } else { + $expr + } + }; + return $self->_expand_expr($e, $logic, $default); } # highly optimized, as it's called way too often