|Perl: the Markov chain saw|
Best Coding practiceby ant (Scribe)
|on Dec 04, 2006 at 16:45 UTC||Need Help??|
ant has asked for the wisdom of the Perl Monks concerning the following question:
I'm wondering what your thoughts are on a coding dilema I seem to have.
I'm maintaing some perl scripts, and I'm tidying up the way they connect to the database etc. I have a main Perl script that calls a database package that I wrote. So I simply call the database package and use the database handler accordingly. However the script is then calling in another package (lets call it TABLE), that also makes calls to the database.
So I'm trying to figure out the best approach, when creating the object TABLE, should I put the database handler in as one of it's attributes in the new method call, and use that or everytime I use a method/sub routine of TABLE should I pass in the database handle as a parameter?
Many thanks in advance
UPDATE: The Script and Package will always connect to the same database as the same user.