On Mon, 2003-11-24 at 15:35, Jordan Lederman wrote:
> > You just have to look at the code you run from httpd.conf and startup.pl
> > to see if it opens any connections.  The code you posted looks fine, but
> > what's in Q2::Init?
> 
>      25 $Apache::DBI::DEBUG = 2;
>      26
>      27 my $dbh = DBI->connect("dbi:Pg:dbname=queue", "queued","", 
> { AutoCommit=> 1, RaiseError => 1, PrintError
>         > 1 } ) or die "Cannot connect to db: $DBI::errstr \n";

Is that inside a sub, or just in the main section of the module?  If
it's in the main part of the module, can you remove it and connect
later?

> I am a bit confused on why I need to connect to the db both in startup.pl and 
> in my module. Can you shed any light on this?

Your connect_on_init() in startup.pl tells Apache::DBI you want it to
create a connection when it spawns child processes.  However, to access
a cached connection in your module, you call DBI->connect and
Apache::DBI intercepts that and hands you back a cached connection if
there is one.

- Perrin


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Reply via email to