>> -----Original Message-----
>> I'm talking for myself here, but the way I usually do this is that I wrap
>> up each SQL query or set of related SQL queries in a subroutine.
>> 
>> If the sub's going to be used as a predicate I make sure it returns
>> true/false and pass all of the relevant data as arguments. By giving it a
>> suitable name, I end up with nicely readable code like
>> 
>>      [...]
>>      if( isSomeCondition( $foo, $baz, $bar ) ){
>>      [...]
>> 
>> More or less straight out of Perl Best Practices, Chapter 3.
>> 
>> HTH,
>> Thomas

I agree with both Thomas and Uri and I will move the SQL/DBI stuff to a sub.

Earlier I thought of using an eval or BEGIN block to evaluate the SQL, but
then I thought wait a minute, that wouldn't be the correct way of using
them. Now I see that doing as you guys recommended is the right way forward.

I fell in love with Perl and open source several years back, but I don't
program much, so each time I sit down to program Perl, I find myself going
back to reference books and this list as I have forgotten pretty much of my
Perl knowledge. In one of my past project I had all the SQL stuff in a
module, but it looks like I didn't plan properly this time.

Uri: I think the quoting is much a religious issue as everyone has their
preferred way, but I now know what you meant. :-)

Thanks
Mimi





-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to