From: Matt S Trout <mst@shadowcat.co.uk>
Date: Mon, 1 Apr 2019 04:07:47 +0000 (+0000)
Subject: stop treating old special ops normally
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fbb885c0bcd32e2e044537a6d4a42111d792c3f0;p=scpubgit%2FQ-Branch.git

stop treating old special ops normally
---

diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm
index 1eae709..cf70129 100644
--- a/lib/SQL/Abstract.pm
+++ b/lib/SQL/Abstract.pm
@@ -168,9 +168,6 @@ sub new {
   # special operators
   $opt{special_ops} ||= [];
 
-  # regexes are applied in order, thus push after user-defines
-  push @{$opt{special_ops}}, @BUILTIN_SPECIAL_OPS;
-
   if ($class->isa('DBIx::Class::SQLMaker')) {
     $opt{warn_once_on_nest} = 1;
     $opt{disable_old_special_ops} = 1;
@@ -734,8 +731,13 @@ sub _expand_expr_hashpair_op {
 
     if (
       (our $Expand_Depth) == 1
-      and $self->{disable_old_special_ops}
-      and List::Util::first { $op =~ $_->{regex} } @{$self->{special_ops}}
+      and (
+        List::Util::first { $op =~ $_->{regex} } @{$self->{special_ops}}
+        or (
+          $self->{disable_old_special_ops}
+          and List::Util::first { $op =~ $_->{regex} } @BUILTIN_SPECIAL_OPS
+        )
+      )
     ) {
       puke "Illegal use of top-level '-$op'"
     }