Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
storing DBI database handle in CGI::Session object ?by spx2 (Deacon) |
on Feb 13, 2008 at 00:35 UTC ( [id://667706]=perlquestion: print w/replies, xml ) | Need Help?? |
spx2 has asked for the wisdom of the Perl Monks concerning the following question:
I've recently wrote a CGI Perl script that is querying a mysql database. The only problem is that every time it is loaded by the same user a new database connection needs to be made which takes time. I thought it would be nice if I could store that database handle in a CGI::Session object so I can reuse it every time and not need to re-connect at least until the cookie used by the CGI::Session object expires. The code I've used is the following: It's also based on what I've read from CGI::Session official documentation :
So I'm expecting that after these lines are run I get a database handle fast.I'm not sure if this code is working properly so I've come to ask the wisdom of the monks to see how to do this? Also,not really intentionally this arises the question What is really a database handle or in short a dbh ? What kind of information does it store ? What is it really ? Thank you
Back to
Seekers of Perl Wisdom
|
|