Search code examples
perlmoose

Can I make a Moose attribute "write once"?


I would like to have a non-required Moose attribute that can be set only once.

If I use is => 'ro' I must set the attribute upon creation of the object, but I want to be able to add it afterwards (as long as it's not been set already).


Solution

  • MooseX::SetOnce