in reply to Multiple Inheritance (DBIx::Class)
Now, as for why you can't bless a reference into more than one class, you need to think about how Perl OO works in the first place:
A Perl "object" is actually just a reference which is associated (via bless) with the namespace of a certain package. (This package is commonly referred to as a "class", but, really, it's just a namespace.) This association tells perl that any subroutines accessed by way of the blessed reference should be resolved within the connected package's namespace, passing the reference itself as the first argument. You can't be in more than one namespace at a time, therefore a reference can't be blessed into more than one "class" at a time.
One way that you might be able to do what you're thinking about ("might" because I don't completely follow your intent) within normal Perl OO would be to access the inherited methods directly by their packages. There's not really anything special about SUPER, so if you have something that's both a Vehicle::Car and a Vehicle::Airplane, you can save it to both classes by calling both Vehicle::Car::save($self) and Vehicle::Airplane::save($self).
|
|---|