Re: Getting DBI working during the server life cycle

Adam Prime <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Boysenberry Payne wrote:
> Hello,
> 
> I'm trying to connect to my postgresql database using the DBI -> Apache::CBI -> DBD::Pg combination of modules.
> I'm having trouble understanding Apache::DBI usage as it pertains to https pre request server life cycle, in particular during the OpenLogs stage.
> My trouble comes from an error I'm getting from DBI:
> 
> Global $r object is not available. Set:
> 	PerlOptions +GlobalRequest
> in httpd.conf at /usr/local/lib/perl5/site_perl/5.10.1/Apache/DBI.pm line 144.
> 
> So, obviously, the Apache::RequestRec object hasn't been globalized because it's before the request stage (the child processes haven't even been forked yet.)
> If I use DBI in my startup.pl file first, no problems, but Apache::DBI says to have it load before DBI to use the persistent connections it offers, thus my dilemma.
> 
> So, what do I do?

Don't use Apache::DBI 1.07 and try to do this, because as you've 
discovered, it's broken.

see: http://rt.cpan.org/Public/Bug/Display.html?id=36346

Adam
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.