From: Matt S Trout Date: Sat, 8 Sep 2018 18:15:00 +0000 (+0000) Subject: regularise more code, switch one test from die to warn verification X-Git-Tag: v1.90_01~471 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd2d5bf75d6babe1a963843632343272ac24b768;p=dbsrgits%2FSQL-Abstract.git regularise more code, switch one test from die to warn verification --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index d0aae08..b664469 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -605,6 +605,11 @@ sub _expand_expr_hashpair { if (my ($rest) = $k =~/^-not[_ ](.*)$/) { return $self->_expand_expr({ -not => { "-${rest}", $v } }, $logic); } + if (my ($logic) = $k =~ /^-(and|or)$/) { + if (ref($v) eq 'HASH') { + return $self->_expand_expr($v, $logic); + } + } } else { unless (defined($v)) { my $orig_op = my $op = $self->{cmp}; diff --git a/t/01generate.t b/t/01generate.t index 5437493..3e55f15 100644 --- a/t/01generate.t +++ b/t/01generate.t @@ -726,9 +726,6 @@ for my $lhs (undef, '') { [ foo => "bar", $lhs => \["baz"], bizz => "buzz" ], [ $lhs => \"baz" ], [ $lhs => \["baz"] ], - - # except for this one, that is automagically arrayified - { foo => "bar", -or => { $lhs => \"baz" }, bizz => "buzz" }, ) { push @tests, { func => 'where', @@ -741,6 +738,7 @@ for my $lhs (undef, '') { ## deprecations - sorta worked, likely abused by folks for my $where_arg ( # the arrayref forms of this never worked and throw above + { foo => "bar", -or => { $lhs => \"baz" }, bizz => "buzz" }, { foo => "bar", -and => { $lhs => \"baz" }, bizz => "buzz" }, { foo => "bar", $lhs => \"baz", bizz => "buzz" }, { foo => "bar", $lhs => \["baz"], bizz => "buzz" },