Miroslav Silovic wrote:
Paul Seamons wrote:
> On closer inspection, is it even possible to add a Role to a Class at
> runtime?

If it isn't now, I would certainly like to have a hook available through
MOP (which is, to the best of my knowledge, still unspecified).

To modify a class at runtime, use C<is also>.

> I thought that Class and Role composition outside of compile time
> resulted in
> a new pseudo Class for the subsequent instances of that composition - in
> which case the original Class would remain unmodified.

I believe 'does' and 'but' operators work that way, yep. Additionally,
they're per instance. Offhand I don't even recall any way to create an
uninstantiated class with a role mixed at runtime (would my
$class_foobar = ::Foo but ::Bar do the trick?)

Probably not; but C<my ::class_foobar := Foo but Bar> might.

Jonathan "Dataweaver" Lang

Reply via email to