in reply to Conditional inheritance strategy

If I get you correctly, you want each object either to be inherited from My::XML or My::JSON, but that doesn't work, as inheritance is a configuration at the class level

One solution would be to store a reference to an object of type My::XML or My::JSON into your objects and call methods from there.

Or you could simply have two classes of type My::XML and My::JSON that both inherit from My