On Fri, Jan 28, 2011 at 09:29:04PM +0100, Zbigniew Lukasiak wrote:
> Are there any sane options for building Moose::Roles out of Non Moose classes?
> 
> Or maybe it is trivial?

You can't just turn a class into a role - that doesn't really make
sense. What you can do is use delegation instead:

  package Foo;
  use Moose::Role;

  has thing => (
      is      => 'ro',
      isa     => 'Some::Non::Moose::Class',
      default => sub { Some::Non::Moose::Class->new },
      handles => ['non_moose_method_1', 'non_moose_method_2'],
  );

See Moose::Manual::Delegation for more details.

-doy

Reply via email to