You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by John ORourke <jo...@o-rourke.org> on 2006/10/27 21:14:59 UTC
MapToStorageHandler and custom config
Hi folks,
I've implemented some custom config directives, works fine.
However, when my MapToStorage handler asks for the per_dir_config hash,
it seems to be getting the server config - all other handlers get the
per-dir no problem.
Any ideas?
cheers
John
Re: MapToStorageHandler and custom config
Posted by John ORourke <jo...@o-rourke.org>.
Thanks for the answers folks... I must've been having a blonde moment,
I'm sure I knew that somewhere.
Skipping the directory walk is one of the reasons I'm using a
MapToStorage handler - no need for all that disk access - but I'm also
using it to map /content/some/path onto /content/<hostname>/some/path,
so I wanted to enable/disable it in <Location>.
I can tell my custom config to write config values into the server config.
cheers
John
Geoffrey Young wrote:
>William A. Rowe, Jr. wrote:
>
>
>>Fred Moyer wrote:
>>
>>
>>
>>>On Fri, 27 Oct 2006, John ORourke wrote:
>>>
>>>
>>>
>>>
>>>>Hi folks,
>>>>
>>>>I've implemented some custom config directives, works fine.
>>>>
>>>>However, when my MapToStorage handler asks for the per_dir_config
>>>>hash, it seems to be getting the server config - all other handlers
>>>>get the per-dir no problem.
>>>>
>>>>
>>>My guess is that you cannot access MapToStorage because at this phase
>>>the request has not yet been associated with a particular filename or
>>>directory [1].
>>>
>>>
>
>yes. in fact, you can't even place the PerlMapToStorageHandler in a
><Location> block, so by definition you won't (yet) have a meaningful
>per-directory config.
>
>I wrote as much hours ago, but my response seems to have vanished into
>the aether. maybe it's been so long since I posted here the list daemon
>is trying to teach me a lesson :)
>
>
>
>>>[1]
>>>http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlMapToStorageHandler
>>>
>>>
>>Note that MapStorageToHandler does this association, so hook ordering plays
>>a huge role. It's critical that if you plan to morph the entity you do so
>>BEFORE the core directory_walk occurs, if you are inspecting it that should
>>happen AFTER to core directory_walk.
>>
>>
>
>pretty much the only honest reason I can think of for writing a
>PerlMapToStorageHandler is for removing directory_walk on servers
>generating 100% dynamic content. of course, we often do very dishonest
>things over here in mod_perl land ;)
>
>--Geoff
>
>
>
Re: MapToStorageHandler and custom config
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
William A. Rowe, Jr. wrote:
> Fred Moyer wrote:
>
>>On Fri, 27 Oct 2006, John ORourke wrote:
>>
>>
>>>Hi folks,
>>>
>>>I've implemented some custom config directives, works fine.
>>>
>>>However, when my MapToStorage handler asks for the per_dir_config
>>>hash, it seems to be getting the server config - all other handlers
>>>get the per-dir no problem.
>>
>>My guess is that you cannot access MapToStorage because at this phase
>>the request has not yet been associated with a particular filename or
>>directory [1].
yes. in fact, you can't even place the PerlMapToStorageHandler in a
<Location> block, so by definition you won't (yet) have a meaningful
per-directory config.
I wrote as much hours ago, but my response seems to have vanished into
the aether. maybe it's been so long since I posted here the list daemon
is trying to teach me a lesson :)
>>
>>[1]
>>http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlMapToStorageHandler
>
>
> Note that MapStorageToHandler does this association, so hook ordering plays
> a huge role. It's critical that if you plan to morph the entity you do so
> BEFORE the core directory_walk occurs, if you are inspecting it that should
> happen AFTER to core directory_walk.
pretty much the only honest reason I can think of for writing a
PerlMapToStorageHandler is for removing directory_walk on servers
generating 100% dynamic content. of course, we often do very dishonest
things over here in mod_perl land ;)
--Geoff
Re: MapToStorageHandler and custom config
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Fred Moyer wrote:
> On Fri, 27 Oct 2006, John ORourke wrote:
>
>> Hi folks,
>>
>> I've implemented some custom config directives, works fine.
>>
>> However, when my MapToStorage handler asks for the per_dir_config
>> hash, it seems to be getting the server config - all other handlers
>> get the per-dir no problem.
>
> My guess is that you cannot access MapToStorage because at this phase
> the request has not yet been associated with a particular filename or
> directory [1].
>
> [1]
> http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlMapToStorageHandler
Note that MapStorageToHandler does this association, so hook ordering plays
a huge role. It's critical that if you plan to morph the entity you do so
BEFORE the core directory_walk occurs, if you are inspecting it that should
happen AFTER to core directory_walk.
It's pretty simple; you shouldn't be modifying resources after they are vetted
by directory_walk.
That's why translations occur in the TranslateName hook. MapToStorage really
should only be used to identify the URL to a resource, and if you are overriding
the default, then a resource not in the filesystem.
Re: MapToStorageHandler and custom config
Posted by Fred Moyer <fr...@redhotpenguin.com>.
On Fri, 27 Oct 2006, John ORourke wrote:
> Hi folks,
>
> I've implemented some custom config directives, works fine.
>
> However, when my MapToStorage handler asks for the per_dir_config hash, it
> seems to be getting the server config - all other handlers get the per-dir no
> problem.
My guess is that you cannot access MapToStorage because at this phase the
request has not yet been associated with a particular filename or
directory [1].
[1]
http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlMapToStorageHandler