NAME

MooX::Readonly::Attribute - Truly readonly attributes

VERSION

Version 1.00

SYNOPSIS

package Test;

use Moo;
use MooX::Readonly::Attribute;

has hash => (
	is => 'ro',
	readonly => 1,
);

has array => (
	is => 'rw',
	readonly => 1,
);

1;

...

my $test = Test->new(
	hash => { a => 1, b => 2, c => 3 },
	array => [ 1, 2, 3 ]
);

$test->hash->{a}; # 1
$test->array->[0]; # 1

$test->hash->{d}; # errors readonly
push @{ $test->array }, 4; # errors readonly

$test->array([4, 5, 6]); 
$test->array->[0]; # 4
$test->array->[0] = 1; # errors readonly

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-moox-readonly-attribute at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooX-Readonly-Attribute. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc MooX::Readonly::Attribute

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2025 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)