Teach ::Tree that ILIKE (PostgreSQL) and REGEXP (MySQL) are binary ops
[dbsrgits/SQL-Abstract.git] / lib / SQL / Abstract / Tree.pm
index ecf950d..79e6ef3 100644 (file)
@@ -1,32 +1,10 @@
 package SQL::Abstract::Tree;
 
-# DO NOT edit away without talking to riba first, he will just put it back
-# BEGIN pre-Moo2 import block
-BEGIN {
-  require warnings;
-  my $initial_fatal_bits = (${^WARNING_BITS}||'') & $warnings::DeadBits{all};
-
-  local $ENV{PERL_STRICTURES_EXTRA} = 0;
-  # load all of these now, so that lazy-loading does not escape
-  # the current PERL_STRICTURES_EXTRA setting
-  require Sub::Quote;
-  require Sub::Defer;
-  require Moo;
-  require Moo::Object;
-  require Method::Generate::Accessor;
-  require Method::Generate::Constructor;
-
-  Moo->import;
-  Sub::Quote->import('quote_sub');
-  ${^WARNING_BITS} &= ( $initial_fatal_bits | ~ $warnings::DeadBits{all} );
-}
-# END pre-Moo2 import block
-
-use strict;
-use warnings;
+use Moo;
 no warnings 'qw';
 
 use Carp;
+use Sub::Quote 'quote_sub';
 
 my $op_look_ahead = '(?: (?= [\s\)\(\;] ) | \z)';
 my $op_look_behind = '(?: (?<= [\,\s\)\(] ) | \A )';
@@ -100,7 +78,7 @@ my $alphanum_cmp_op_re = join ("\n\t|\n", map
 );
 $alphanum_cmp_op_re = qr/$alphanum_cmp_op_re/x;
 
-my $binary_op_re = '(?: NOT \s+)? (?:' . join ('|', qw/IN BETWEEN R?LIKE/) . ')';
+my $binary_op_re = '(?: NOT \s+)? (?:' . join ('|', qw/IN BETWEEN [RI]?LIKE REGEXP/) . ')';
 $binary_op_re = join "\n\t|\n",
   "$op_look_behind (?i: $binary_op_re | AS ) $op_look_ahead",
   $alphanum_cmp_op_re,