perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jk jk" <jk.lists.questi...@gmail.com>
Subject Re: Problem with RequestRec and Headers
Date Mon, 24 Sep 2007 00:56:28 GMT
I'm trying to port a pre-existing application built using a singleton
design.  Various class instances use a __PACKAGE__::getInstance() method to
get a handle on the current request's instance.  getInstance just returns
$self which is a global variable.  This works as a cgi, since every request
is in a separate interpreter.  It does not in mod_perl for obvious reasons.
It was my impression that the most direct method of porting would be to use
Class::Singleton (Apache::Singleton::Request).  Any other ideas?  Thanks.
--JAK

On 9/23/07, Perrin Harkins <perrin@elem.com> wrote:
>
> On 9/23/07, jk jk <jk.lists.questions@gmail.com> wrote:
> > I've been trying to use Apache::Singleton::Request under the assumption
> that
> > you're right about Class::Singleton being the crux of the issue.
> > Unfortunately, I can't get it working under Apache2.  Is there a
> different
> > module for mp2/apache2 ?
>
> It should be easy to port if you want to.  I wonder why you're trying
> to use a singleton at all though.  It seems like either you should
> create a new object every time, or just use class methods if you don't
> need an object.  If this was just to get access to the request object,
> you don't need it.  You can always get the request object from
> anywhere using Apache2::RequestUtil.
>
> By the way, a quick look at Class::Singleton confirms what Philippe
> said: the instance() method just returns an existing instance after
> the first call and ignores all parameters.  It's not a mod_perl
> incomaptibilty; it's the intended behavior of the module.
>
> - Perrin
>

Mime
View raw message