On 07/28/2008 01:30 PM, Mark Stosberg wrote:
>>> If I'm right, then something like this would stay shared:
>>>
>>> our $dbh = DBI->connect(...);
>>> $self->dbh_config($dbh);
>> But don't do that. It's just asking for problems. DB connections *will*
>> go stale. If that happens your application will stop working with
>> strange errors and only a restart will fix it. This is the problem that
>> Apache::DBI solves for mod_perl. If you want to learn how to do this on
>> your own, then I suggest looking in there for some pointers. But I will
>> warn you that Apache::DBI doesn't do the magic on it's own. DBI knows
>> about Apache::DBI. So any code you write yourself won't have that advantage.
>
> Michael is right. The DBH plugin does have a way to cope with this, though.
> Like this:
>
> our $dbh = sub { DBI->connect(...) }
> $self->dbh_config($dbh);
>
http://search.cpan.org/~timb/DBI-1.607/DBI.pm#connect_cached
--
Peter Karman . [EMAIL PROTECTED] . http://peknet.com/
##### CGI::Application community mailing list ################
## ##
## To unsubscribe, or change your message delivery options, ##
## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ##
## ##
## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ##
## Wiki: http://cgiapp.erlbaum.net/ ##
## ##
################################################################