tomgracey has asked for the wisdom of the Perl Monks concerning the following question:
Supposing I have a dog
my $dog = DOG->new; Then later I decide my dog is in fact a labrador. I could do bless $dog, 'LABRADOR';which (i think) would be fine as LABRADOR inherits from DOG
but Moose has things like
has color => (is => 'rw', isa => 'Str', default => 'golden')If I simply bless my $dog into LABRADOR then he won't be golden. How can I resolve this situation?
(I guess what I'm really asking is - is there a way to change the class of an object that already exists under Moose? Or perhaps this is not the done thing?)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: changing moose object classes on the go
by moritz (Cardinal) on Mar 19, 2013 at 18:40 UTC | |
Re: changing moose object classes on the go
by blue_cowdawg (Monsignor) on Mar 19, 2013 at 18:45 UTC | |
by tomgracey (Scribe) on Apr 24, 2013 at 09:55 UTC | |
Re: changing moose object classes on the go
by Brutha (Friar) on Apr 08, 2013 at 13:19 UTC |
Back to
Seekers of Perl Wisdom