This is a point where you really need mixins if you want to stick with object inheritance, but maybe you should rethink whether "file sorter" IS-A File::Collector or whether File::Collector HAS-A "file sorter" (or many file sorters as the case may be).
The idea of subclassing File::Collector to add categories seemed neat at the beginning, but this is starting to get unmaintainable.
To do this with mixins, define a "final derived class" that inherits from File::Collector and any number of "mixin" classes that provide sorting categories, using a form of the _run_chain method you mentioned in Unable to turn off strict refs to invoke methods across the mixins instead of working up a SUPER:: chain as the earlier versions did. Your application can adjust the @...::ISA array in that derived class (which should be otherwise empty) according to configuration, as LanX mentioned. Rewriting inheritance chains at runtime, while possible in Perl, is getting very close to "thermonuclear footgun" on the maintainability scale, and is almost certainly best avoided.
In reply to Re: Creating dynamic parent/child relationships
by jcb
in thread Creating dynamic parent/child relationships
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |