![]() |
|
go ahead... be a heretic | |
PerlMonks |
Best Coding practiceby ant (Scribe) |
on Dec 04, 2006 at 16:45 UTC ( #587689=perlquestion: print w/replies, xml ) | Need Help?? |
ant has asked for the wisdom of the Perl Monks concerning the following question:
Hi, 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 Ant UPDATE: The Script and Package will always connect to the same database as the same user.
Back to
Seekers of Perl Wisdom
|
|