Torsten Schoenfeld wrote in perl.module-authors :
> Aloha,
>
> over in gtk2-perl land, we'd like to split out the Gtk2::Pango stuff from the
> Gtk2 module into its own module with the namespace Pango. We would like to
> do
> this in a backwards compatible way so that any code that is using the
> Gtk2::Pango stuff continues to work just fine when we switch Gtk2 over to use
> the new Pango.
>
> So we basically do this in Gtk2.pm:
>
> use Pango;
> {
> no strict 'refs';
> foreach my $key (keys %Pango::) {
> *{'Gtk2::Pango::' . $key} = *{'Pango::' . $key};
> }
> }
>
> For some reason, this has the effect that the following lines both evaluate
> to true:
>
> Pango::Layout->isa (Gtk2::Pango::Layout::);
> Gtk2::Pango::Layout->isa (Pango::Layout::);
>
> Now, that's really good because we need those to evaluate to true for
> backwards
> compatibility. The problem is that I don't understand *why* they are true.
I think I understand *why*. At least in 5.10.
> I attach a simple standalone program that demonstrates this behavior. perl
> 5.8.8, 5.10.0, and blead all output two "1"s when running this program on my
> machine. perl 5.6.2, however, evaluates "New->isa(Old::)" to false.
>
> So I wonder if it is safe to rely on the behavior exhibited by perl >= 5.8.
> Or
> is it just some implementation-dependent artifact? Is there a better way to
> achieve what I want?
I think it's safe.
A quick look shows that bleadperl does not have tests for this behaviour
in t/mro/*.t. I suggest that you turn your example program into a test
and submit it to perl5-porters. The best way to ensure that a behaviour
will not break in a next release is to add a regression test for it :)