You are clobbering Gtk2::Pango symbol table and trying to implement and
check is-a relationship, which is OO stuff. I just checked Gtk2::Pango and
it seems to consist of only constants. So, IMO, you can just say:

package Gtk2::Pango;
#...
use Pango; # import all constants into Gtk2::Pango
our @EXPORT = @Pango::EXPORT;
1;

-----Original Message-----
From: Torsten Schoenfeld [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 09, 2008 6:59 PM
To: module-authors@perl.org
Subject: Package aliases and isa()

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

Reply via email to