On Fri, Mar 19, 2010 at 02:22:21PM -0400, Sir Robert Burbridge wrote: > Hey all, > > I've read through the Moose::Manual::Types, > Moose::Util::TypeConstraints, and other things I could find. I don't > quite see how I am supposed to create a property that holds "a > derivative of class X". For example, I would like to do: > > package A; > use Moose; > 1; > > package B; > use Moose; > extends A; > 1; > > package C; > use Moose; > has a => (isa=>'A', is=>'rw'); > 1; > > ### Create "B" which extends "A" > my $b = B->new(); > > ### Create C with property "a" of value $b. $b is an "A" derivative, > ### so I'd like it to be ok with that. > my $c = C->new(a=>$b);
Um... did you actually try to run this code? Because it already does exactly what you are trying to do. -doy
