From: Matt S Trout Date: Mon, 15 Jul 2019 22:06:31 +0000 (+0000) Subject: is_op and register_op X-Git-Tag: v1.90_01~145 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=550eaa6ffa926e921c23635166b5d0d982060a1f;p=dbsrgits%2FSQL-Abstract.git is_op and register_op --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index ea1a508..97e1816 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -543,7 +543,9 @@ sub render_expr { sub _normalize_op { my ($self, $raw) = @_; - s/^-(?=.)//, s/\s+/_/g for my $op = lc $raw; + my $op = lc $raw; + return $op if grep $_->{$op}, @{$self}{qw(is_op expand_op render_op)}; + s/^-(?=.)//, s/\s+/_/g for $op; $op; } diff --git a/lib/SQL/Abstract/Clauses.pm b/lib/SQL/Abstract/Clauses.pm index 74bb20e..88a3226 100644 --- a/lib/SQL/Abstract/Clauses.pm +++ b/lib/SQL/Abstract/Clauses.pm @@ -394,6 +394,8 @@ BEGIN { } } +sub register_op { $_[0]->{is_op}{$_[1]} = 1; $_[0] } + sub statement_list { sort keys %{$_[0]->{clauses_of}} } sub clauses_of {