Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: Problem managing persistent database connections in modules

by mp (Deacon)
on Jul 26, 2002 at 00:35 UTC ( [id://185391]=note: print w/replies, xml ) Need Help??


in reply to Re: Problem managing persistent database connections in modules
in thread Problem managing persistent database connections in modules

Your reply was helpful. I now have the following to create a singleton database handle.
package MyProject::DbhSingleton; use Apache::Singleton::Request; use base (qw Apache::Singleton::Request); sub _new_instance { my $dbh = DBI->connect($dsn, $user, $pass, $attr) or die DBI->errstr +; }
This would work if I called it within every method (sub) that does database access, but I'm looking for a way to avoid going to that extreme.
  • Comment on Re: Re: Problem managing persistent database connections in modules
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://185391]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-24 09:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found