|Welcome to the Monastery|
Changing the Class Name of a Moose Instanceby jandrew (Chaplain)
|on Oct 03, 2012 at 15:37 UTC||Need Help??|
jandrew has asked for the
wisdom of the Perl Monks concerning the following question:
I have been searching unsuccessfully for a way to change the class name of a Moose instance. Most specifically when I am composing Moose classes on the fly using Moose::Util 'with_traits'. Any helpful suggestions are appreciated.
The initial use case for me is to make the confess output from Carp more readable. I have included demonstration code below.
The output is as follows
The goal would be to set -Moose::Meta::Class::__ANON__::SERIAL::1- to something more human readable.
It seems there might be other use cases for this but as a minimum the 'meta' capabilities of Moose have spoiled me into believing that all information about an instance is accessible and mutable as needed. I just can't seem to figure out how.
Update: spelling corrections