SQL::Abstract::More is a drop-in, completely compatible extension of SQL::Abstract that adds significant functionality. The main thing I like is the join syntax. The main thing I hate is that he overloaded the SQL::Abstract API, so that the same function does different things based on whether it is called with named or positional parameters:
# positional parameters, directly passed to the parent class my ($sql, @bind) = $sqla->select($table, $columns, $where, $order); # named parameters, handled in this class my ($sql, @bind) = $sqla->select( -columns => \@columns, # OR: -columns => [-distinct => @columns], -from => $table || \@joined_tables, -where => \%where, -order_by => \@order, -group_by => \@group_by, -having => \%having_criteria, -limit => $limit, -offset => $offset, # OR: -page_size => $size, -page_index => $index, -for => $purpose, );
IMHO, he should've used different function names for the different calling interface. Why? Because a function converts input to output and different input belongs in a different function. What do you think? Do you like Laurent's approach or would you have preferred a different function like me?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SQL::Abstract::More overloads the SQL::Abstract API
by jdrago999 (Pilgrim) on Aug 31, 2011 at 06:40 UTC | |
|
Re: SQL::Abstract::More overloads the SQL::Abstract API
by dami (Initiate) on Sep 01, 2011 at 10:25 UTC | |
by dragonchild (Archbishop) on Oct 19, 2011 at 12:51 UTC | |
|
Re: SQL::Abstract::More overloads the SQL::Abstract API
by locked_user sundialsvc4 (Abbot) on Aug 31, 2011 at 01:14 UTC | |
by metaperl (Curate) on Aug 31, 2011 at 15:36 UTC | |
by locked_user sundialsvc4 (Abbot) on Sep 02, 2011 at 15:11 UTC |