MooseX::ClosedHash - blessed coderefs (closing over a hash) with Moose
use v5.14; package Person { use MooseX::ClosedHash; has name => (is => "rw"); has age => (is => "rw"); __PACKAGE__->meta->make_immutable; } my $bob = Person->new(name => "Bob", age => 42); say $bob->name, " is ", $bob->age, " years old."; say $bob->dump;
MooseX::ClosedHash is a Moose module that lets you store your object's attributes in a hash, closed over by a blessed coderef.
Why? I have no idea why you'd want to do this.
It provides a modicum of privacy I suppose. Privacy that is easily violated, but that you're unlikely to accidentally violate.
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=MooseX-ClosedHash.
http://www.perlmonks.org/?node_id=1039960.
MooseX::ArrayRef, MooseX::GlobRef, MooseX::InsideOut, etc.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install MooseX::ClosedHash, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::ClosedHash
CPAN shell
perl -MCPAN -e shell install MooseX::ClosedHash
For more information on module installation, please visit the detailed CPAN module installation guide.