>>>>> "MC" == Mimi Cafe <mimic...@googlemail.com> writes:

  MC> I need to evaluate a statement in an if, elsif, else block, and
  MC> the statement to evaluate in the elsif is too large as I need to
  MC> run a SQL query and act on the return value.  What would be a
  MC> better way to achieve this? Putting the SQL statement elsewhere
  MC> outside the block cannot be right, so I am wondering what to do
  MC> here.

first off, show some code. you can't improve something without seeing
it.

in general don't put large chunks of code inside conditionals. and with
sql and dbi code, i like to wrap them in subs and call them as
needed. that both keeps the sql/dbi code separated and allows for reuse
of the code. in fact i recently did a project where i put all the dbi
code in a separate module as several scripts were going to share
it. even if each script didn't use all the subs, it makes for better
code organization.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
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