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 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?

-Torsten
package New;
use strict;
use warnings;

package Old;
use strict;
use warnings;

{
  no strict 'refs';
  *{'Old::'} = *{'New::'};
}

package main;
use strict;
use warnings;

warn Old->isa(New::);
warn New->isa(Old::);

Reply via email to