From: Matt S Trout Date: Mon, 15 Jul 2019 22:06:31 +0000 (+0000) Subject: is_op and register_op X-Git-Tag: v2.000000~3^2~166 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=63fbb8b344c39c49e8a43495db3f2c93fc7e53a0;p=dbsrgits%2FSQL-Abstract.git is_op and register_op --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 0c99319..0ffa4af 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 {