Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Passing arrayref to Moose attributes

by hdb (Monsignor)
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2018-03-18 06:19 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (228 votes). Check out past polls.