Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Passing arrayref to Moose attributes

by hdb (Parson)
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 http://search.cpan.org/~mstrout/Moo-1.001000/lib/Moo.pm:

isa

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] },


Comment on Re: Passing arrayref to Moose attributes
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (16)
As of 2014-08-27 13:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (238 votes), past polls