in reply to How can I make struct members writeable using MooX::Struct?

Perl does not have structs (i.e. data that has a fixed set of named slots). The nearest equivalent would be a locked hash:
use Hash::Util qw( lock_keys ); my %doc = ( filename => '', fileID => undef, tags => [] ); lock_keys(%doc);
If you look behind the mask of a MooX::Struct, you'll find that it is just a hash and doesn't have the fixed keys property you may expect from real structs e.g.
%> reply 0> use MooX::Struct -rw, Document => [ qw( $fileID $filename @tags ) +]; 1> my $doc = Document[ 1, "PetsFile"]; $res[0] = bless( { 'fileID' => 1, 'filename' => 'PetsFile' }, 'MooX::Struct::__ANON__::0001' ) 2> $doc->{foo} = 'bar'; $res[1] = 'bar' 3> delete $doc->{fileID}; $res[2] = 1 4> $doc $res[3] = bless( { 'filename' => 'PetsFile', 'foo' => 'bar' }, 'MooX::Struct::__ANON__::0001' ) 5>
I used reply but you could also use Data::Dumper to do the inspection.