Re: interest in converting LWP / Mech hierarchy to roles?
Ovid <[email protected]>
| Newsgroups | gmane.comp.lang.perl.quality-assurance |
|---|---|
| Message-ID | <[email protected]> |
Hi Mark, I think this is a fantastic idea! I actually think that much of this could be done very easily via a "has-a" relationship and delegation in the role. Thus, the roles themselves can be put together very quickly. The downside is maintaining them in case the modules they depend on change. Cheers, Ovid -- Twitter - http://twitter.com/OvidPerl/ Buy my book - http://bit.ly/beginning_perl Buy my other book - http://www.oreilly.com/catalog/perlhks/ Live and work overseas - http://www.overseas-exile.com/ >________________________________ > From: Mark Stosberg <[email protected]> >To: perl-qa <[email protected]> >Sent: Wednesday, 27 February 2013, 17:04 >Subject: interest in converting LWP / Mech hierarchy to roles? > > >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 > > >