in reply to Re^3: Passing arrayref to Moose attributes
in thread Passing arrayref to Moo attributes
Under Moose you need to add traits => ["Array"] to the attribute declaration. See Moose::Meta::Attribute::Native::Trait::Array.
With Moo you'd use handles_via => "Array" but you'd need to install MooX::HandlesVia first.
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Passing arrayref to Moose attributes
by davido (Cardinal) on Apr 21, 2013 at 14:14 UTC |
In Section
Seekers of Perl Wisdom