From: Matt S Trout <mst@shadowcat.co.uk>
Date: Wed, 10 Apr 2019 01:32:48 +0000 (+0000)
Subject: expand , args while not doubling listification
X-Git-Tag: v1.90_01~238
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bd00b85c552ca9b51d06de615a669725dd3e69af;p=dbsrgits%2FSQL-Abstract.git

expand , args while not doubling listification
---

diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm
index 4a2d3d1..35a971d 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