MooX::SetOnce - write-once attributes for Moo
package MyClass; use Moo; use MooX::SetOnce; has attr => ( is => 'rw', once => 1 );
MooX::SetOnce creates attributes that are not lazy and not set, but that cannot be altered once set.
The logic is very simple: if you try to alter the value of an attribute with the SetOnce trait, either by accessor or writer, and the attribute has a value, it will throw an exception.
If the attribute has a clearer, you may clear the attribute and set it again.
If a Moose module extends or composes a module using MooX::SetOnce, MooseX::SetOnce will be loaded to provide the Moose implementation.
haarg - Graham Knop (cpan:HAARG) <haarg@haarg.org>
None so far.
Copyright (c) 2013 the MooX::SetOnce "AUTHOR" and "CONTRIBUTORS" as listed above.
This library is free software and may be distributed under the same terms as perl itself.
To install MooX::SetOnce, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooX::SetOnce
CPAN shell
perl -MCPAN -e shell install MooX::SetOnce
For more information on module installation, please visit the detailed CPAN module installation guide.