Mark Stosberg
2013-02-27 16:04:05 UTC
There's perhaps no better illustration of the values of roles vs
inheritance in CPAN modules than the mess than that the LWP inheritance
tree.
There's so many modules that extend LWP or Mechanize through
sub-classing, but can't easily be combined with getting into diamond
inheritance:
Here's a sampling of LWP subclasses:
WWW::Mechanize
LWP::UserAgent::POE
Test::LWP::UserAgent
LWP::UserAgent::Cached
LWP::UserAgent::ProxyAny;
LWP::UserAgent::Snapshot;
LWP::UserAgent::Keychain;
LWP::Parallel::UserAgent;
LWP::UserAgent::Determined;
Then you have the WWW::Mechanize sub-classes. Here's a sampling:
Test::WWW::Mechanize
WWW::Mechanize::Query
WWW::Mechanize::Cached
WWW::Scripter
Now, if you'd like to combine one of these of the features extensions
from any these, good luck! Trial-and-error, and possible @ISA-hacking
lie ahead of you. Maybe you'll find a valid combination. Maybe not.
Now, if the extensions were written as roles, combining the extensions
would be. There could still be conflicts and incompatibilities, but I
think things would be far more likely to present themselves up front.
Perhaps if some of these get converted to extend-by-roles instead of
extend-by-inheritance, some others will follow along, and we'll end up
with a more useful of collection of Perl-based browser extensions.
Mark
inheritance in CPAN modules than the mess than that the LWP inheritance
tree.
There's so many modules that extend LWP or Mechanize through
sub-classing, but can't easily be combined with getting into diamond
inheritance:
Here's a sampling of LWP subclasses:
WWW::Mechanize
LWP::UserAgent::POE
Test::LWP::UserAgent
LWP::UserAgent::Cached
LWP::UserAgent::ProxyAny;
LWP::UserAgent::Snapshot;
LWP::UserAgent::Keychain;
LWP::Parallel::UserAgent;
LWP::UserAgent::Determined;
Then you have the WWW::Mechanize sub-classes. Here's a sampling:
Test::WWW::Mechanize
WWW::Mechanize::Query
WWW::Mechanize::Cached
WWW::Scripter
Now, if you'd like to combine one of these of the features extensions
from any these, good luck! Trial-and-error, and possible @ISA-hacking
lie ahead of you. Maybe you'll find a valid combination. Maybe not.
Now, if the extensions were written as roles, combining the extensions
would be. There could still be conflicts and incompatibilities, but I
think things would be far more likely to present themselves up front.
Perhaps if some of these get converted to extend-by-roles instead of
extend-by-inheritance, some others will follow along, and we'll end up
with a more useful of collection of Perl-based browser extensions.
Mark