From: Matt S Trout Date: Mon, 18 Mar 2019 04:43:33 +0000 (+0000) Subject: extract _expand_bool method X-Git-Tag: v2.000000~3^2~387 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7642d9ff9bcdacc503079a78cb85c4d44f0b2016;p=dbsrgits%2FSQL-Abstract.git extract _expand_bool method --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 7629bb3..0ac8fdd 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -195,14 +195,7 @@ sub new { -ident => '_expand_ident', -value => '_expand_value', -not => '_expand_not', - -bool => sub { - my ($self, undef, $v) = @_; - if (ref($v)) { - return $self->_expand_expr($v); - } - puke "-bool => undef not supported" unless defined($v); - return $self->_expand_ident(-ident => $v); - }, + -bool => '_expand_bool', }; return bless \%opt, $class; @@ -925,6 +918,15 @@ sub _expand_not { +{ -op => [ 'not', $_[0]->_expand_expr($_[2]) ] }; } +sub _expand_bool { + my ($self, undef, $v) = @_; + if (ref($v)) { + return $self->_expand_expr($v); + } + puke "-bool => undef not supported" unless defined($v); + return $self->_expand_ident(-ident => $v); +} + sub _recurse_where { my ($self, $where, $logic) = @_;