Subject: | Use Delegation Instead of Inheritance |
If you specify this:
use HTML::TableExtract 'tree';
You inherit from HTML::TreeBuilder.
If you use do this:
use HTML::TableExtract;
You inherit from HTML::Parser;
This has caused us a bug which was hard to track down. Specifically, we
had code which used 'tree' and ran perfectly when we ran it manually.
However, our integration tests failed because a module loaded later did
not use 'tree', thus causing our 'tree' instances to have the wrong
inheritance tree.
I'd recommend using delegation instead of inheritance so that methods
could redispatch on a per-instance basis, rather than globally.
Cheers,
Ovid