Re: Closing DB handler with PerlCleanupHandler

[prev] [thread] [next] [Date index for 2004/11/10]

From: Batara Kesuma
Subject: Re: Closing DB handler with PerlCleanupHandler
Date: 07:37 on 10 Nov 2004
Hi Perrin,

> It looks to me like you are creating this problem by using "our".  Why
> 
> not use "my" and pass the handle around, or put it somewhere like 
> $r->pnotes() instead?

Yes I should have used 'my' and passed the handle around :(

> Also, why do you want to avoid persistent connections?

Because the DB is running out of memory just to keep the persistent
connections, I just want to try it without persistent connections and
see the result. If the overhead is not too big, I might just change it
to use normal connections.

I tried this to disconnect the handler in PerlCleanupHandler, but it
didn't work.

## httpd.conf
<FilesMatch "\.pl$">
  SetHandler perl-script
  PerlResponseHandler ModPerl::Registry
  PerlOptions +ParseHeaders
  PerlCleanupHandler MyApache::Cleanup
  Options +ExecCGI
</FilesMatch>


## MyApache::Cleanup.pm
package MyApache::Cleanup;
use strict;
sub handler {
    my ($r) = @_;
    our $dbh;
    if ($dbh) {
        print STDERR "Got ya!!";
        $dbh->disconnect();
    }
    return 200;
}
1;

I can't get $dbh from module that is called by PerlCleanupHandler. $dbh
is created by scripts in ModPerl::Registry. How can I disconnect 'our
$dbh' created by scripts within ModPerl::Registry in PerlCleanupHandler?

Regards,
--bk


        -- 
        Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Closing DB handler with PerlCleanupHandler
Batara Kesuma 02:47 on 10 Nov 2004

Re: Closing DB handler with PerlCleanupHandler
Stas Bekman 02:46 on 10 Nov 2004

Re: Closing DB handler with PerlCleanupHandler
Batara Kesuma 03:51 on 10 Nov 2004

Re: Closing DB handler with PerlCleanupHandler
Stas Bekman 04:07 on 10 Nov 2004

Re: Closing DB handler with PerlCleanupHandler
Perrin Harkins 06:47 on 10 Nov 2004

Re: Closing DB handler with PerlCleanupHandler
Batara Kesuma 07:37 on 10 Nov 2004

Re: Closing DB handler with PerlCleanupHandler
Timour Ezeev 15:27 on 10 Nov 2004

Re: Closing DB handler with PerlCleanupHandler
Perrin Harkins 20:30 on 10 Nov 2004

Re: Closing DB handler with PerlCleanupHandler
Glenn Strauss 08:41 on 10 Nov 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52