cLive ;-) has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a module to call common requests I make through DBI for a job I'm on. I could open and close my DB handle for each request, or hard code them into my scripts, but what I was wondering is, "Is there a standard way to check whether a $dbh object exists and is open?".
ie, when I call a data query sub in the module, it only opens a handle if one is not already open? That way I could just call a "dbh_tidy()" sub at the end to close the dbh and exit.
All thoughts, as always, appreciated :)
cLive ;-)
PS - Hope the above makes sense...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: checking whether DBI connection made
by chromatic (Archbishop) on Aug 16, 2001 at 06:08 UTC | |
|
Re: checking whether DBI connection made
by dga (Hermit) on Aug 16, 2001 at 05:40 UTC | |
|
Re: checking whether DBI connection made
by blakem (Monsignor) on Aug 16, 2001 at 03:12 UTC | |
|
Re: checking whether DBI connection made
by faure (Sexton) on Aug 16, 2001 at 06:25 UTC | |
|
(elbie): checking whether DBI connection made
by elbie (Curate) on Aug 16, 2001 at 17:57 UTC |