Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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 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 perusing the Monastery: (10)
As of 2015-07-30 21:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls