> > My code around line 1059 in MySQLBroker.pm looks like this:
> >
> > sub _mysql_exec {
> >   my ($self, $dbcall) = @_;
> >   my @resultsArray;
> >   my $count=0;
> >   my $sth = $self->{_dbh}->prepare("$dbcall");
> 
> You shouldn't store a $dbh in your objects like this.  Apache::DBI
> will check that your connection is still good when you try to use it,
> but only if you call connect().  If you don't, your connection can go
> stale and get dropped.

Aside from that, a general trick that seems to help sometimes is 
changing "my" to "local our".  But I believe Perrin is right, you 
should have your scripts call connect() at their beginnings, and 
Apache::DBI will do the caching for you.

Kev

Reply via email to