In Moose you can declare a group of attributes at once, assuming the initialization parameters are the same:
has [qw( foo bar baz )] => (
is => 'ro',
isa => 'Str',
required => 1,
);
This is a lovely feature that saves a ton of typing. However, I find myself puzzled about how define a predicate, clearer or even a builder method using this syntax.
has 'foo' => (
is => 'ro',
isa => 'Str',
required => 1,
clearer => 'clear_foo',
predicate => 'has_foo',
);
Is there a parameter I can use that will build standard 'has_X, 'clear_X
and _build_X
methods for all the attributes in my list?