I usually end the class when compiling through __PACKAGE__->meta->make_immutableat the end of the class. However, when should I make a class immutable, which creates roles in itself at runtime? Should I do this to improve performance or is it incompatible with make_immutable? make_immutableseems to speed up the creation of the object, but does it do anything after the creation of the object?
For example, something like strings:
BUILD {
my $self = shift;
use Module::Load;
for my $role ($self->_determine_roles()) {
load $role;
$role->meta->apply($self);
}
$self->meta->make_immutable;
}
, , 'Foo', , 'Foo' ( anon ), 'Bar' ? , , ?
Moose:: Meta:: Class, , , . , make_immutable, ?