Designing a module that uses a DBI connection
- From: davec@xxxxxxxxxxxx (David Coulthart)
- Date: Wed, 27 Jun 2007 09:44:30 -0400
I'm currently writing a non-OO perl module where the methods exported
communicate with a database using DBI.
My question is what is the best practice for connecting and
disconnecting from the database within a perl module like this?
Should I provide connect and disconnect methods that the user is
required to call before & after using the other methods? If I do this,
do I blindly assume in my other methods that the user has indeed called
connect or should each method begin with a check to make sure the dbh is
valid?
Another idea I was pondering was using BEGIN and END blocks. Something
about this feels like overkill to me, but maybe it is the right answer
in this situation.
Is there some other way I should be considering?
Thx,
David Coulthart
.
- Prev by Date: Re: DBI-1.58 test failure on Windows
- Next by Date: Re: [GENERAL] How do you handle shared memory corruption issues? (contrib/xml2)
- Previous by thread: DBI V 1.58 under Strawberry Perl
- Next by thread: Re: [GENERAL] How do you handle shared memory corruption issues? (contrib/xml2)
- Index(es):
Relevant Pages
|