Re: Role methods on roles, not classes

2009-10-12 Thread Ovid
- Original Message From: Jesse Luehrs d...@tozt.net package Thing; use Moose; with ( DoesRobot = { excludes = 'draw', aliases = { draw = 'draw_with_arm' }, 'DoesDrawable' ); Again, if the robot was a delegate rather than a role, you'd have

Re: Role methods on roles, not classes

2009-10-12 Thread Jesse Luehrs
On Mon, Oct 12, 2009 at 02:54:05AM -0700, Ovid wrote: - Original Message From: Jesse Luehrs d...@tozt.net package Thing; use Moose; with ( DoesRobot = { excludes = 'draw', aliases = { draw = 'draw_with_arm' }, 'DoesDrawable' ); Again, if

Re: Role methods on roles, not classes

2009-10-12 Thread Chris Prather
On Mon, Oct 12, 2009 at 5:54 AM, Ovid publiustemp-catal...@yahoo.com wrote: - Original Message From: Jesse Luehrs d...@tozt.net   package Thing;   use Moose;   with (     DoesRobot = { excludes = 'draw', aliases = { draw = 'draw_with_arm' },     'DoesDrawable'   );

Re: Role methods on roles, not classes

2009-10-12 Thread Hans Dieter Pearcey
Excerpts from Ovid's message of Mon Oct 12 11:53:23 -0400 2009: So instead of this: package Thing; use Moose; with ( DoesRobot = { excludes = 'draw', aliases = { draw = 'draw_with_arm' } }, 'DoesDrawable' ); You recommend this: package Thing; use Moose; has

Re: Role methods on roles, not classes

2009-10-12 Thread Jesse Luehrs
On Mon, Oct 12, 2009 at 12:09:26PM -0400, Hans Dieter Pearcey wrote: The fact that a hammer's no good for washing clothes doesn't mean you can't still bash nails with it. package HasRobot; use Moose::Role; requires @some_methods; has robot_arm = ( is = 'ro', isa =

Re: Role methods on roles, not classes

2009-10-12 Thread Chris Prather
On Mon, Oct 12, 2009 at 11:53 AM, Ovid publiustemp-catal...@yahoo.com wrote: --- On Mon, 12/10/09, Jesse Luehrs d...@tozt.net wrote: From: Jesse Luehrs d...@tozt.net Yeah, something like this would work:   package Thing;   use Moose;   has robot_arm = (       is      = 'ro',       isa   

Role methods on roles, not classes

2009-10-08 Thread Ovid
Hi all, This problem is annoying and I'm not sure of the best approach. Let's say I have a list of roles and an object and I want to serialize the object as XML. Imagine the following (this is my actual use case): sub to_xml { my $self = shift; my $xml = ''; # string XML sucks.

Re: Role methods on roles, not classes

2009-10-08 Thread Jesse Luehrs
On Thu, Oct 08, 2009 at 07:26:40AM -0700, Ovid wrote: Hi all, This problem is annoying and I'm not sure of the best approach. Let's say I have a list of roles and an object and I want to serialize the object as XML. Imagine the following (this is my actual use case): sub to_xml {

Re: Role methods on roles, not classes

2009-10-08 Thread Jesse Luehrs
On Thu, Oct 08, 2009 at 10:06:06AM -0500, Jesse Luehrs wrote: Again, if the robot was a delegate rather than a role, you'd have $thing-draw_with_arm delegated to $thing-robot_arm-draw, but $thing-robot_arm-draw would still be available to be called separately: Another thing about delegation