From: Peter Rabbitson Date: Wed, 22 Sep 2010 10:09:34 +0000 (+0000) Subject: Replace one more grep with a regex X-Git-Tag: v1.70~51 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6f01d627f158b296303694408fe7cf8dc1395483;p=dbsrgits%2FSQL-Abstract.git Replace one more grep with a regex --- diff --git a/lib/SQL/Abstract/Test.pm b/lib/SQL/Abstract/Test.pm index 1ae1a36..c6e909c 100644 --- a/lib/SQL/Abstract/Test.pm +++ b/lib/SQL/Abstract/Test.pm @@ -26,6 +26,8 @@ my @unrollable_ops = ( 'HAVING', 'ORDER \s+ BY', ); +my $unrollable_ops_re = join ' | ', @unrollable_ops; +$unrollable_ops_re = qr/$unrollable_ops_re/xio; sub is_same_sql_bind { my ($sql1, $bind_ref1, $sql2, $bind_ref2, $msg) = @_; @@ -228,7 +230,7 @@ sub _parenthesis_unroll { } # if the parent operator explcitly allows it nuke the parenthesis - elsif ( grep { $ast->[0] =~ /^ $_ $/xi } @unrollable_ops ) { + elsif ( $ast->[0] =~ $unrollable_ops_re ) { push @children, $child->[1][0]; $changes++; }