Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Persistent Fault Tolerant SQL (MySQL + DBI) connections!

by MidLifeXis (Monsignor)
on Dec 23, 2009 at 13:02 UTC ( #814089=note: print w/replies, xml ) Need Help??

in reply to Persistent Fault Tolerant SQL (MySQL + DBI) connections!

Update: Don't take these rather short comments as anything personal. They are purely comments on the code itself, in an effort to improve the end product, make maintenance easier, etc.

Some general comments:

  • I am not certain of the benefit of using do("") over making this a package and useing it.
  • This would also allow you to use strict; use warnings; (or use commonsense; ;-) )
  • You have many undeclared variables ($sql_a, $sql_r, etc), which use strict; would tell you.
  • You are using the &mysub(...) style of calling functions instead of mysub(...). There are (infrequent) times to use it, but this does not appear to be one of those times.
  • instead of warn "my warning message", you are using print "my warning message". warn... is the typical way to do this, as it generates line numbers and puts the information on stderr.
  • Don't use exit;, use die;, as die can be trapped with an eval.
  • If your eval statement in the sql subroutine failed due to a constraint in the database, wouldn't this end up causing an infinite loop?

This is not everything (I have not had my morning coffee as of yet), but it would be some good points to start asking questions.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://814089]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2018-06-18 13:47 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (109 votes). Check out past polls.