in reply to Re: Moose composing role with required attribute into existing instance
in thread Moose composing role with required attribute into existing instance
To this:my $point = with_traits( 'MyClass', ( 'Point', 'Named' ), )->new( x => 1, y => 1, name => 'my_point', );#To satisfy the required values
The first argument should be the base class you are composing roles into and all remaining arguments should be roles. I wouldn't have bothered correcting this here but maybe it will help someone else. Excellent solution.my $point = with_traits( 'Point', 'Named', )->new( x => 1, y => 1, name => 'my_point', );#To satisfy the required values
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Moose composing role with required attribute into existing instance
by jandrew (Chaplain) on Aug 03, 2012 at 20:33 UTC |