package Foo; my $pkg = __PACKAGE__; sub new { my $class = shift; return bless {$pkg => {basetype => $pkg}}, $class; } sub showBase { my $self = shift; print ref ($self) . ": $self->{$pkg}{basetype}\n"; } package Bar; my $pkg = __PACKAGE__; sub new { my $class = shift; return bless {$pkg => {basetype => $pkg}}, $class; } sub showBase { my $self = shift; print ref ($self) . ": $self->{$pkg}{basetype}\n"; } package Baz; use base qw(Foo Bar); sub new { my $class = shift; my $bar = Bar::new ($class); my $foo = Foo::new ($class); my %self; @self{keys %$foo} = values %$foo; @self{keys %$bar} = values %$bar; return bless \%self, $class; } package Boo; use base qw(Foo Bar); sub new { my $class = shift; my $bar = Bar::new ($class); my $foo = Foo::new ($class); my %self; @self{keys %$foo} = values %$foo; @self{keys %$bar} = values %$bar; return bless \%self, $class; } sub showBase { my $self = shift; Foo::showBase ($self); Bar::showBase ($self); } package main; my $baz = Baz->new (); my $boo = Boo->new (); print "Baz's showBase:\n"; $baz->showBase (); print "Boo's showBase:\n"; $boo->showBase (); #### Baz's showBase: Baz: Foo Boo's showBase: Boo: Foo Boo: Bar