Subject: | merge classes? |
use Blessed::Merge;
my $blessed = Blessed::Merge->new({ merge_classes => 1 });
my $world = $blessed->merge( Foo->new, Bar->new );
$world->isa('Foo'); # true
$world->isa('Bar'); # true
This would be pretty easy to implement.
1. Detect if multiple classes are being merged. You already do this. If they're all the same class, then bless $world into that class.
2. If one of those classes is a superclass of all the others, then bless $world into that class.
3. Otherwise, set @Blessed::Merge::__ANON__::000001::ISA = qw(Foo Bar) and bless $world into "Blessed::Merge::__ANON__::000001". (You'll need to keep a counter and increment it.)