From: Matt S Trout Date: Mon, 18 Mar 2019 04:56:48 +0000 (+0000) Subject: add notreached barf to and/or processing X-Git-Tag: v2.000000~3^2~386 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eb8a82d9ca8c16fb4294ec417786d4fb0a435a48;p=dbsrgits%2FSQL-Abstract.git add notreached barf to and/or processing --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 0ac8fdd..8584e19 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -642,6 +642,7 @@ sub _expand_expr_hashpair { if (ref($v) eq 'ARRAY') { return $self->_expand_expr($v, $logic); } + die "notreached"; } { my $op = $k; @@ -661,9 +662,6 @@ sub _expand_expr_hashpair { return { -op => [ $op, $v ] }; } } - if (my $custom = $self->{expand_unary}{$k}) { - return $self->$custom($v); - } if ($self->{render}{$k}) { return { $k => $v }; } @@ -1134,16 +1132,15 @@ sub _expand_order_by { puke "ordering direction hash passed to order by must have exactly one key (-asc or -desc)"; } } - my @exp = map +(defined($dir) ? { -op => [ $dir => $_ ] } : $_), + my @exp = map +( + defined($dir) ? { -op => [ $dir =~ /^-?(.*)$/ ,=> $_ ] } : $_ + ), map $self->expand_expr($_, -ident), map ref($_) eq 'ARRAY' ? @$_ : $_, @to_expand; return (@exp > 1 ? { -list => \@exp } : $exp[0]); }; - local @{$self->{expand_unary}}{qw(-asc -desc)} = ( - sub { shift->$expander(asc => @_) }, - sub { shift->$expander(desc => @_) }, - ); + local @{$self->{expand}}{qw(-asc -desc)} = (($expander) x 2); return $self->$expander(undef, $arg); }