The base class (for these purposes) for a "quant" object is Rx::quant. If you write an add-on, MyRxA, then a MyRxA::quant object's @ISA is (Rx::quant). If you write an add-on, MyRxB, then a MyRxB::quant object's @ISA is (Rx::quant).
MyRxA::quant::raw() changes the output of all quantifiers to '%' characters; this means a+b would render as a%b.
MyRxB::quant::visual() makes the quantifier appear before the thing it quantifies; a+b would render as +ab.package MyRxA::quant; sub raw { my $self = shift; return "%"; }
package MyRxB::quant::visual; sub visual { my $self = shift; return $self->raw . $self->{data}->visual; }
Now we want to write MyRxC, which uses MyRxA and MyRxB as base classes. This means we want a+b to render as %ab. (Confusing? Sorry. Just bear with me.) The problem is that, because of the way @ISA is set up, an object of MyRxC::quant has the following inheritence tree:
I haven't considered the more difficult scenario of two classes overriding the same method.
I'm stuck. I'm not sure how to traverse the @ISA tree properly. I don't think NEXT has the right tools for the job. I kind of want an "OVER::", not a "NEXT::" or "SUPER::". It looks like I want a breadth-first @ISA scan, not a depth-first scan. What I really want is to avoid looking in Rx for the method until the VERY end. Maybe the solution, then, is not to put Rx in the @ISA tree, but rather to look in Rx after all others have failed, via AUTOLOAD?
In reply to Multiple Inheritence, Munging @ISA by japhy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |