|
|
| Syntactic Confectionery Delight | |
| PerlMonks |
changing moose object classes on the goby tomgracey (Sexton) |
| on Mar 19, 2013 at 18:10 UTC ( #1024349=perlquestion: print w/ replies, xml ) | Need Help?? |
|
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?)
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||