On 02/28/2013 03:26 PM, Mike Doherty wrote:
> On 13-02-28 09:07 AM, Yanick Champoux wrote:
>> On 13-02-27 11:04 AM, Mark Stosberg wrote:
>>> 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.
>>
>>      I don't have a lot to add to the conversation at the moment, but I
>> just wanted to '++' the idea
> 
> Same here. I've had two separate projects at university that both would
> have been easier had the LWP stuff been done as roles. As it seems
> everyone thinks this is probably a good idea, the real question becomes
> "Who is going to do the work?" -- as usual :)

One of the nice parts about this, is that it can be backwards
compatible. For example, if we wanted to make this change in
WWW::Mechanize, we could make WWW::Mechanize::Role, and move (hopefully)
all the functionality in there, and then WWW::Mechanize would like this:

  package WWW::Mechanize;
  use Moo;
  extends 'LWP::UserAgent';
  with 'WWW::Mechanize::Role';
  1;

I mocked this up with Moo, as it's both Moose-compatible, and a lighter
dependency. Any other Moose-compatibile role option seems like it would
be a fine choice.

People could go on using WWW::Mechanize as they have been, but now
there's a new option to use it a role in a complex user agent if desired.

   Mark

Reply via email to