1 package Data::Query::ExprBuilder;
4 use Data::Query::Constants qw(DQ_OPERATOR DQ_VALUE);
12 Data::Query::ExprBuilder->new({
15 operator => { Perl => $op },
16 args => [ $_[0]->{expr} ]
23 my ($overload, $as) = ref($_) ? @$_ : ($_, $_);
25 Data::Query::ExprBuilder->new({
28 operator => { Perl => $as },
31 (Scalar::Util::blessed($_)
32 && $_->isa('Data::Query::ExprBuilder'))
36 subtype => { Perl => 'Scalar' },
39 # we're called with ($left, $right, 0) or ($right, $left, 1)
40 } $_[2] ? @_[1,0] : @_[0,1]
46 qw(+ - * / % ** << >> . < > == != lt le gt ge eq ne),
48 # since 'and' and 'or' aren't operators we borrow the bitwise ops
49 [ '&' => 'and' ], [ '|' => 'or' ],
54 $op => sub { die "Can't use operator $op on a ".ref($_[0]) }
60 bless({ %{$_[1]} }, (ref($_[0])||$_[0]));