[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: mod_perl 2.0 globals question
From:       Stas Bekman <stas () stason ! org>
Date:       2004-05-29 3:57:01
Message-ID: 40B80A0D.7050408 () stason ! org
[Download RAW message or body]

Nathanial P. Hendler wrote:
> Yes, I'd read that section several times before posting.  I understand
> that the setting is enabled at some points, disabled at others, and can be
> enabled.  I don't have an old version if CGI.pm, and I don't understand
> what that has to do with anything.  It seems to do more than just setup
> the global $r object, since it changes the way all my globals behave.
> 
> I'd like to know if people want access to $r in their modules, and if so,
> do they pass their modules $r, or do they turn on GlobalRequest, and is it
> a sane thing to do?

the best and the safest approach is to pass it around.

You could also use a Singleton. There are a few of them on CPAN and there is 
one example how to write your own in the "Practical mod_perl" book.

> On Fri, 28 May 2004, Stas Bekman wrote:
> 
> 
>>Nathanial P. Hendler wrote:
>>[...]
>>
>>>What does GlobalRequest do
>>>exactly, and is there a better way to get Apache->request in modules?
>>
>>http://perl.apache.org/docs/2.0/user/config/config.html#C_GlobalRequest_
>>
>>


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic