On Mon, 2004-03-15 at 22:27 -0500, Geoffrey Young wrote:
> >> Unless anybody can think of a better solution, and if adding back a
> >> dependency on Tie::IxHash, i'll work on a patch to add Tie::IxHash magic
> >> to %Location, %VirtualHost, %Directory, etc...
> > 
> > 
> > Think more about it, I doubt it will help. Take a look at how David and
> > most users do it:
> > 
> > $Location = { "/data" => { SetHandler => 'default-handler' },
> >                 "/data/preview" => {
> >                     SetHandler       => 'perl-script',
> >                     PerlFixupHandler =>
> > 'Bric::App::PreviewHandler::fixup_handler',
> >                     PerlHandler      => 'Bric::App::Handler'
> >                }};
> > 
> > it's too late to add any magic, since the original order is lost long
> > before you can add the magic.

True, that's why it sould be at least clearly documented that the right
way of doing something like that is :

$Location{"/data"} = [...];
$Location{"/data/preview"} = [...];

Then at least, for common one-level cases, the Tie::IxHash magic could
certainly help. Otherwise, even with documentation, how is one supposed
to achieve something like that?

> > I think it's a user-side problem, not the server side. All <perl>
> > section has to be careful about is not to copy anything, so that if a
> > user makes $Location a tied hash, <perl> section won't override it. May
> > be just documenting the issue will do the trick?

I am certainly for more documentation and less code ;-)

> IIRC, mp1 uses Tie::IxHash magically behind the scenes if it is available.
> however, it's still not enough, not only because it only goes one level deep
> (and thus won't hold multiple levels as in Stas example) but also because
> Tie::IxHash is itself insufficient.  consider RewriteRule, RewriteRule,
> RewriteMap.

That's absolutely correct, and I was even thinking that the proper way
to handle something like this would need to delegate Tie::IxHash and
such magic to the actual handler for the <Perl> block, and that's hard,
since the handler is called to late to be of any help. And I woultn'd
want to see 'Location', 'VirtualHost' and such stuff in mp_cmd_perldo()

> my suggestion is to nix the Tie::IxHash magic and just be sure that the
> <Perl> implementation respects multi-tiered tied hashes - both Tie::IxHash
> and Tie::DxHash.

Yes, put the responsability of doing:

tie %Location, 'Tie::XX';

if they need ordering and such.

Then add a few tests to the <Perl> tests to make sure it's dealing with
tied entities correctly.

I'll take a shot at it this week unless someone wants to beat me to it.

> --Geoff
> 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to