Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Perl OO with Class::Struct

by tobyink (Abbot)
on Dec 13, 2013 at 16:24 UTC ( #1067040=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl OO with Class::Struct
in thread Perl OO with Class::Struct

Actually, isa => 'ArrayRef' doesn't work in Moo at all. (Unless you also use MooX::late which is my Moose/Moo compatibility shim.)

In Moo, isa needs to be a coderef, or an object overloading &{}.

use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name


Comment on Re^2: Perl OO with Class::Struct
Select or Download Code
Replies are listed 'Best First'.
Re^3: Perl OO with Class::Struct
by davido (Archbishop) on Dec 13, 2013 at 16:33 UTC

    You're right; I should have said, "isa => ArrayRef", which is compatible with Moo when used with MooX::Types::MooseLike::Base.

    Personally I always just use sub { ... } so that I can take finer control.

    I'll update my post to remove the quotes from the isa check.


    Dave

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2015-07-08 01:15 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 (93 votes), past polls