[Dbix-class] [OT][ANNOUNCE] SQL Generation with SQL::DB
    Mark Lawrence 
    nomad at null.net
       
    Thu Sep  6 19:07:14 GMT 2007
    
    
  
On Thu Sep 06, 2007 at 01:05:21PM -0400, Jason Kohles wrote:
> On Sep 6, 2007, at 12:24 PM, Matt Rosin wrote:
> 
> >>>>   where => $lname->like('%son%') & ! ($age < 10 | $age > 20 )
> >
> >Just curious, could this work too? Or do subtle precedence  
> >differences wreck it?
> >
> >where, ( $lname->like('%son') and not ($age < 10 or $age > 20) )
> >
> Changing '&' to 'and' is more than a subtle precedence difference...
Correct. I must apologise for having used the term logic operators when
referring to "|", "&" and "!" which are in fact all bitwise logic operators.
Bitwise operators can be overloaded with Perl's overload.pm which is how
SQL::DB (and Tangram, where I first saw this approach) do their magic.
Unfortunately their big brothers (&&,||,not,and,or) cannot be overloaded.
Because the bitwise ops have similar meanings to their counterparts
their usage looks "close enough" to the real thing, so it doesn't take
long to get comfortable with that.
Mark.
-- 
Mark Lawrence
    
    
More information about the DBIx-Class
mailing list