perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Radoslaw Zielinski <ra...@karnet.pl>
Subject Re: [apr] dropping Apache2/ subdir for APR::*
Date Fri, 19 Nov 2004 12:22:29 GMT
Stas Bekman <stas@stason.org> [14-11-2004 17:05]:
> Radoslaw Zielinski wrote:
[...]
>>> to support this aliasing feature. Or do you suggest to just alias the 
>>> namespaces?
>> Maybe I'm missing something.  I was thinking about just aliasing the
>> namespaces.
> It's a way more complicated than it seems to be at first sight. Search the 
> dev list's archives for EazyLife to see some of the problems.

Done...  OK, so AUTOLOAD is just a can of worms.

But, as the code we're trying to make work already knows which
modules does it need to work, we can try a different approach:
trap the "use Apache::OldName" calls with a subroutine ref in @INC.
Example implementation attached; would this work?

I actually don't really like it, as it's a hack, but... I can't see
how this could impact on anything.

Well, let's see what I've missed now ;-)

>>> Second, quite a few methods have the same API name, but a totally 
>>> different functionality. Please see lib/Apache/compat.pm starting from 
>>> overridable_mp2_api.
>>> I can't see how the two can coexist.
>>   $ cat MP2/Foo.pm 
>>   package MP2::Foo;
>>   sub sf { print shift() . "::same\n"; }
>>   sub df { print shift() . "::different\n"; }
>>   1;
> [...]
>> ...well, maybe in a smarter way.  Note, that this allows coexistence of
>> both mp1 and mp2 applications in one interpreter.
> The problem is that mp1 and mp2 aren't fully compatible, and there is no 
> way to make them so 100%, mainly. So you have a problem here. You can't 
> run all mp1 and mp2 applications under the same interpreter. Again take a 
> look at lib/Apache/compat.pm %overridable_mp2_api and read:
> http://perl.apache.org/docs/2.0/api/Apache/compat.html#Compatibility_Functions_Colliding_with_mod_perl_2_0_API

I've seen it before and still don't see a problem, when we have *different
namespaces*.  I assume, that the compatibility layer is similar (in
effect, not necessarily the implementation) to the attached one.

Can the problem you're seeing be resolved by (I don't know how to do it
mod_perl-wide; maybe a per-VirtualHost/Location directive, telling mp2
to return objects blessed into a specific namespace for a given handler?):

  package handler_for_mp1_partially_ported_to_mp2;
  sub handler {
    my $r = bless shift, 'Apache::RequestRec'; # was Apache2::RequestRec
    # same thing with $c or whatever
    ...
  }

> I think I've mentioned this already, I'm not disagreeing with you, 
> Radoslaw, that I've wished there was a better way than what we have now. 
> But if you really start implementing your proposal you will see that there 
> are problems in your idea. And some of them might be the showstopper. You 
> are more than welcome to prove me/us wrong with a concrete working code.

Are you saying that this namespace change could -- if implemented --
still get to mp2?

-- 
Radosław Zieliński <radek@karnet.pl>
[ GPG key: http://radek.karnet.pl/ ]

Mime
View raw message