class_has for Moops

115 views Asked by At

Is there something like MooseX::ClassAttribute for Moops?

Note, that I want static/class attributes using the Moo backend, as I do not want to bring in the Moose backend.

2

There are 2 answers

0
Toby Inkster On

I wrote a MooX::ClassAttribute, but there are often better ways to do things than class attributes.

If you want "ro" class data, then consider use constant instead.

If you want "rw" data, then consider an our variable, which has an advantage over class attributes: you can use the local keyword to dynamically scope changes. (And if you want type constraints, then Type::Tie.)

0
Borodin On

It looks like what you need is MooX::ClassAttribute

"declare class attributes Moose-style... but without Moose"