[Dbix-class] SQL::Abstract -nest modifier
Peter Rabbitson
rabbit+dbic at rabbit.us
Mon May 18 13:27:53 GMT 2009
Hi everyone,
With SQLA 2.0 coming closer to reality, there was a substantial effort
to clear up and disambiguate the SQLA 1.x API. One of the remaining
quirks is the -nest operator, which was introduced in version 1.18.
The examples provided in the documentation make no sense from a
usability point of view, as all of them are more clearly expressed
by other means. Consider (lifted from POD of 1.55)
my %where = (
user => 'nwiger',
-nest => [ workhrs => {'>', 20}, geo => 'ASIA' ],
);
VS
my %where = (
user => 'nwiger',
-or => [ workhrs => {'>', 20}, geo => 'ASIA'],
);
and
my @where = (
-and => [
user => 'nwiger',
-nest => [
-and => [workhrs => {'>', 20}, geo => 'ASIA' ],
-and => [workhrs => {'<', 50}, geo => 'EURO' ]
],
],
);
VS
my @where = (
-and => [
{ user => 'nwiger' },
[
-and => [workhrs => {'>', 20}, geo => 'ASIA' ],
-and => [workhrs => {'<', 50}, geo => 'EURO' ]
],
],
);
The development team of SQLA 2.0 would like to know if there are
real-world -nest usages which can not be easily expressed in any
other ways. If this is not the case, -nest will be marked as
deprecated by a warning starting with the next SQLA version, and
will be completely removed in 2.0.
Any input/thoughts welcome!
More information about the DBIx-Class
mailing list