Think about Loose Coupling | |
PerlMonks |
Re: dbi style questions (code, discussion)by BazB (Priest) |
on Dec 29, 2001 at 15:13 UTC ( [id://135105]=note: print w/replies, xml ) | Need Help?? |
At this point, I've only used a combination of Tcl and SQL to query a database.
Have a look at Philip Greenspun's SQL for Web Nerds, particularly the style section. When I've coded scripts with large SQL queries, I often put the query into a string: Then query the database with the command required (can't do it in Perl yet :-) with $query in that command instead of a lump of SQL and scripting/Perl mashed together. Even if you don't like my idea of having the query seperate, or it's impossible, then just get used formatting the queries so that they stand out from the Perl and are readable as SQL.
Hope that helps, Update: Seems like a slight more Perl-y way of doing this might be to use HERE documents, as described in this node by steves. Further update: fixed the link to SQL for Web Nerds
In Section
Seekers of Perl Wisdom
|
|