in reply to Modification of @ISA at run time
Hello,
your last example look a lot like a goto!
In fact, it works a bit like the goto considered harmfull. It all comes down to code reuse. If your object/class modifies, under certain unusual conditions, it's inheritance tree and thus its behaviour, it becomes very difficult to inherit from such class. You'd have to know in advance all possible scenarios of behaviour of your object/class before reuse. Checking wheter or not your object is of a certain type becomes very difficult because its type depends on an internal 'if'.
It's better (easier for maintenance, easier to comprehend, easier for reuse) to fix your inheritance first, at compile time maybe, or by convention by never changing @ISA.
|
|---|