Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Passing arrayref to Moose attributes

by hdb (Prior)
on Apr 20, 2013 at 14:12 UTC ( #1029643=note: print w/replies, xml ) Need Help??

in reply to Passing arrayref to Moo attributes

In the headline, you are asking a Moose question but in the code you are using Moo. Does Moo support 'ArrayRef' etc as well? If I change use Moo; to use Moose; and follow moritz' advise, I get no error anymore. I am not too familiar with Moo and Moose, just a guess..

UPDATE: Just found this on


Takes a coderef which is meant to validate the attribute. Unlike Moose, Moo does not include a basic type system, so instead of doing isa => 'Num', one should do

isa => sub { die "$_[0] is not a number!" unless looks_like_number $_[0] },

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1029643]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2016-10-23 00:08 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (299 votes). Check out past polls.