if (ref($expr) eq 'HASH') {
return undef unless my $kc = keys %$expr;
if ($kc > 1) {
- return $self->_expand_op_andor(and => $expr);
+ return $self->_expand_logop(and => $expr);
}
my ($key, $value) = %$expr;
if ($key =~ /^-/ and $key =~ s/ [_\s]? \d+ $//x ) {
return $self->_expand_hashpair($key, $value);
}
if (ref($expr) eq 'ARRAY') {
- return $self->_expand_op_andor(lc($self->{logic}), $expr);
+ return $self->_expand_logop(lc($self->{logic}), $expr);
}
if (my $literal = is_literal_value($expr)) {
return +{ -literal => $literal };
# hash with multiple or no elements is andor
if (ref($v) eq 'HASH' and keys %$v != 1) {
- return $self->_expand_op_andor(and => $v, $k);
+ return $self->_expand_logop(and => $v, $k);
}
# undef needs to be re-sent with cmp to achieve IS/IS NOT NULL
? (shift(@{$v = [ @$v ]}), $1)
: lc($self->{logic} || 'OR')
);
- return $self->_expand_op_andor(
+ return $self->_expand_logop(
$logic => $v, $k
);
}
"operator '%s' applied on an empty array (field '$k')"
) ? $self->sqlfalse : $self->sqltrue);
}
- return $self->_expand_op_andor($logic => \@values, $k);
+ return $self->_expand_logop($logic => \@values, $k);
}
if (is_undef_value($vv)) {
my $is = ($self->_dwim_op_to_is($op,
] };
}
+sub _expand_logop {
+ my ($self, $logop, $v, $k) = @_;
+ $self->${\$self->{expand_op}{$logop}}($logop, $v, $k);
+}
+
sub _expand_op_andor {
my ($self, $logop, $v, $k) = @_;
if (defined $k) {