In sub Bar, you're calling $g->Foo, where $g is the return value of $self->group. Looking at the code of SVG::Element, that's a new SVG::Element. SVG::Element doesn't have a sub Foo, which is why the call fails.
Yes! I was aware of that. But I was expecting that, since $self was a MyPackage object, its progeny would be the same species...
Anyway the SVG::Element::Foo trick seems to work, thank you all very much for your responses!
In reply to Re^2: Extending a class (updated)
by betacentauri
in thread Extending a class
by betacentauri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |