How can I use MooseX :: ClassAttribute in a role?

I would like to use MooseX :: ClassAttribute in the role. Ie do something like

package Cachable; use Moose::Role; use MooseX::ClassAttribute; class_has Cache => ( is => 'rw' ); 1; 

Unfortunately, the above code does not work as deep magic. MooseX :: ClassAttribute expects to be called from a Moose object, not Moose :: Role.
Is there a way around this, or is this a known limitation?

+4
source share
1 answer

You send me a patch that does the job. This is certainly possible, although Moose internals make it harder than it should be due to the way the roles handle attributes.

+3
source

All Articles