From: Matt S Trout Date: Wed, 10 Apr 2019 01:32:48 +0000 (+0000) Subject: expand , args while not doubling listification X-Git-Tag: v2.000000~3^2~259 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2a999514cdaadebf89e387c9dc17859165a99daa;p=dbsrgits%2FSQL-Abstract.git expand , args while not doubling listification --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 3283a6b..91790f0 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -1258,7 +1258,8 @@ sub _expand_order_by { return unless defined($arg) and not (ref($arg) eq 'ARRAY' and !@$arg); - return $arg if ref($arg) eq 'HASH' and ($arg->{-op}||[''])->[0] eq ','; + return $self->_expand_maybe_list_expr($arg) + if ref($arg) eq 'HASH' and ($arg->{-op}||[''])->[0] eq ','; my $expander = sub { my ($self, $dir, $expr) = @_; @@ -1345,7 +1346,10 @@ sub _table { sub _expand_maybe_list_expr { my ($self, $expr, $default) = @_; - return $expr if ref($expr) eq 'HASH' and ($expr->{-op}||[''])->[0] eq ','; + return { -op => [ + ',', map $self->expand_expr($_, $default), + @{$expr->{-op}}[1..$#{$expr->{-op}}] + ] } if ref($expr) eq 'HASH' and ($expr->{-op}||[''])->[0] eq ','; return +{ -op => [ ',', map $self->expand_expr($_, $default), ref($expr) eq 'ARRAY' ? @$expr : $expr