I wasn't sure how to do the path mentioned in the link so I just manually 
edited the Apache::DBI file and added the eval around the line requesting 
Apache2::RequestRec and it seems to work now.
Thanks for the heads up.  All of the literature I have mentions Apache::DBI for 
use with mod_perl.
I did look at DBI::Class as the Apache::DBI author mentioned, but I would 
rather use Apache::DBI and do the class structure myself.

Seems like an easy enough thing to patch into Apache::DBI to avoid these head 
aches, wonder why the author isn't?

Thanks again,
Boysenberry Payne

On Jan 23, 2010, at 9:34 PM, Adam Prime wrote:

> 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
> 
> 

Reply via email to