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.use Hash::Util qw( lock_keys ); my %doc = ( filename => '', fileID => undef, tags => [] ); lock_keys(%doc);
I used reply but you could also use Data::Dumper to do the inspection.%> 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>
In reply to Re: How can I make struct members writeable using MooX::Struct?
by Arunbear
in thread How can I make struct members writeable using MooX::Struct?
by dissident
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |