Immutable Role for Perl 5
package Example; use Moo; with 'Data::Object::Role::Immutable'; package main; my $example = Example->new;
This package provides a mechanism for making any derived object immutable.
This package implements the following methods:
immutable() : Object
The immutable method returns the invocant as an immutable object, and will throw an error if an attempt is made to modify the underlying value.
immutable example #1
# given: synopsis $example->immutable;
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".