Have you considered letting the method calls return the object?
Hmm, what does that mean?
google.com/search?q="return the method" site:www.perldoc.com
A quick read of the Data::Dumper source later;
Wow, thanks, that works great!
There is a lot more I would like to implement, but at the moment I'm constrained by the specific requirements of the project I'm doing at work, at what functionality the module needs for that. - Unfortunately, it'll very much be a 'add it as it's required' approach.
I will be looking further at your other suggestions though, thanks!
For now however, I've changed it so that doing,
use strict;
use warnings;
use SQL::Builder::Select;
my $select = new SQL::Builder::Select;
$select->column( '*' )
->table( 'main' )
->where_ne_or( 'col1' )
->where_eq_and( 'col1', 'col2' )
->where_logic( 'a and o')
->order_by( 'col1' )
->limit_value( 10 )
->limit_offset( 20 )
->debug( 1 );
print $select->return();
gives the output
DEBUG: logic broken up
'a ', 'AND', ' o'
DEBUG: joining
AND - 'col1 = ?', 'col2 = ?'
DEBUG: no need to join
'col1 != ?'
DEBUG: joining
AND - '(col1 = ?) AND (col2 = ?)', 'col1 != ?'
DEBUG: sql
SELECT * FROM main WHERE ((col1 = ?) AND (col2 = ?)) AND (col1 !=
+?) ORDER BY col1 LIMIT 20, 10
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.