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
