replacing a method of a Moose object at runtime
- by xxxxxxx
Hi, is it possible to replace a method of a Moose object at runtime ?
By looking at the source code of Class::MOP::Method(which Moose::Meta::Method inherits from) I concluded that by doing
$method->{body} = sub{ my stuff }
I would be able to replace at runtime a method of an object.
I can get the method using
$object->meta->find_method_by_name(<method_name>);
However.. this didn't quite work out.
Is it conceivable to modify methods at runtime ? and what is the way to do it with Moose ?
Thanks