More types
- Any class:
package Bar;
use Moose;
use Some::Foo;
has 'primary_foo' => (
is => 'ro',
isa => 'Some::Foo', # must be isa('Some::Foo')
default => sub { Some::Foo->new( primary => 1 ) },
);
has 'foos' => (
is => 'ro',
isa => 'ArrayRef[Some::Foo]'
default => sub { [] },
);
Class->new; # OK, since everything has defaults
Class->new( primary_foo => Some::Foo->new ); # again OK
Class->new( foos => ['bar'] ) # not OK, 'bar' is not a Some::Foo