You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by ja...@lawrence.net on 2002/02/01 22:39:49 UTC
Indentifying dir_config's
I'm wondering if there is a way that I can mark or remeber that
I've seen a particular dir_config during a previous request. The
motivation is performance related - so that I can set up for
particular set of "PerlSetVar" values only the once. Then
subseqeuent requests to that child will use a previously
determined value (instanciated object).
IE: in my httpd.conf I have -
PerlSetVar myvalue 100
<Location "/test">
PerlSetVar myvalue 200
</Location>
<Location "/different">
PerlSetVar myvalue 300
</Location>
So - request 1 - GET /test
I check dir_config("myvalue") and setup.
Can I mark that I was here; sorta like the equivalent of
<Location "/test">
PerlSetVar myvalue 200
PerlSetVar signature myvalue_200
</Location>
request 2 - GET /test
I want to know I was here before because I see
that signature was set and I'll recall that.
I was hoping that would work but setting a dir_config seems to
go into the server-level and not to the calling container.
Would there be another approach? Perhaps there is already a
signature that would help me uniquely identify which set of
containers made the call?
Worst case scenario I could hash all the dir_config values and
use that as my signature - but I was hoping there would be
something cheaper to do. :)
TIA and if this is unclear let me know and I'll get more detailed.
Re: Indentifying dir_config's
Posted by Jay Lawrence <Ja...@Lawrence.Net>.
Robert - that's along the lines of what I'm after. My nuance is that I might
have several different configurations for the server - since there are
several
different containers that have different PerlSetVar directives.
In my example below a call to "/test" is going to have a different config
to a call to "/different" or a call to "/". How can I do three different
intializations for these different configurations and then keep track of
them for the remaining requests?
Jay
----- Original Message -----
From: "Robert Landrum" <rl...@capitoladvantage.com>
To: <ja...@lawrence.net>; <mo...@apache.org>
Sent: Friday, February 01, 2002 5:02 PM
Subject: Re: Indentifying dir_config's
> At 1:39 PM -0800 2/1/02, jay@lawrence.net wrote:
> >I'm wondering if there is a way that I can mark or remeber that
> >I've seen a particular dir_config during a previous request. The
> >motivation is performance related - so that I can set up for
> >particular set of "PerlSetVar" values only the once. Then
> >subseqeuent requests to that child will use a previously
> >determined value (instanciated object).
> >
> >IE: in my httpd.conf I have -
> >
> >PerlSetVar myvalue 100
> >
> ><Location "/test">
> > PerlSetVar myvalue 200
> ></Location>
> >
> ><Location "/different">
> > PerlSetVar myvalue 300
> ></Location>
> >
> >So - request 1 - GET /test
> > I check dir_config("myvalue") and setup.
> > Can I mark that I was here; sorta like the equivalent of
> > <Location "/test">
> > PerlSetVar myvalue 200
> > PerlSetVar signature myvalue_200
> > </Location>
> >
>
> I'm not sure if I understand...
>
> I've done something in one of my modues in the past...
>
> package MyHandler;
>
> our $INITED = 0;
>
> our %CONFIG = ();
>
> sub handler {
> ....
> unless($INITED) {
> %CONFIG = $self->get_config($r);
> $INITED = 1;
> }
> ....
> }
>
>
> That way I only have to get_config once per forked process... This
> is very useful for static (or near static) data. In this example
> get_config was pulling configuration directives from an Oracle
> database.
>
> Rob
>
>
>
>
> --
> When I used a Mac, they laughed because I had no command prompt. When
> I used Linux, they laughed because I had no GUI.
>
Re: Indentifying dir_config's
Posted by Robert Landrum <rl...@capitoladvantage.com>.
At 1:39 PM -0800 2/1/02, jay@lawrence.net wrote:
>I'm wondering if there is a way that I can mark or remeber that
>I've seen a particular dir_config during a previous request. The
>motivation is performance related - so that I can set up for
>particular set of "PerlSetVar" values only the once. Then
>subseqeuent requests to that child will use a previously
>determined value (instanciated object).
>
>IE: in my httpd.conf I have -
>
>PerlSetVar myvalue 100
>
><Location "/test">
> PerlSetVar myvalue 200
></Location>
>
><Location "/different">
> PerlSetVar myvalue 300
></Location>
>
>So - request 1 - GET /test
> I check dir_config("myvalue") and setup.
> Can I mark that I was here; sorta like the equivalent of
> <Location "/test">
> PerlSetVar myvalue 200
> PerlSetVar signature myvalue_200
> </Location>
>
I'm not sure if I understand...
I've done something in one of my modues in the past...
package MyHandler;
our $INITED = 0;
our %CONFIG = ();
sub handler {
....
unless($INITED) {
%CONFIG = $self->get_config($r);
$INITED = 1;
}
....
}
That way I only have to get_config once per forked process... This
is very useful for static (or near static) data. In this example
get_config was pulling configuration directives from an Oracle
database.
Rob
--
When I used a Mac, they laughed because I had no command prompt. When
I used Linux, they laughed because I had no GUI.