Hash::Wrap Hash::Wrap creates objects from hashes, providing accessors for hash elements. The objects are hashes, and may be modified using the standard Perl hash operations and the object's accessors will behave accordingly. Why use this class? Sometimes a hash is created on the fly and it's too much of a hassle to build a class to encapsulate it. sub foo () { ... ; return { a => 1 }; } With "Hash::Wrap": use Hash::Wrap; sub foo () { ... ; return wrap_hash( { a => 1 ); } my $obj = foo (); print $obj->a; Elements can be added or removed to the object and accessors will track them. The object may be made immutable, or may have a restricted set of attributes. There are many similar modules on CPAN (see "SEE ALSO" for comparisons). What sets Hash::Wrap apart is that it's possible to customize object construction and accessor behavior: * It's possible to use the passed hash directly, or make shallow or deep copies of it. * Accessors can be customized so that accessing a non-existent element can throw an exception or return the undefined value. * On recent enough versions of Perl, accessors can be lvalues, e.g. $obj->existing_key = $value; INSTALLATION This is a Perl module distribution. It should be installed with whichever tool you use to manage your installation of Perl, e.g. any of cpanm . cpan . cpanp -i . Consult http://www.cpan.org/modules/INSTALL.html for further instruction. Should you wish to install this module manually, the procedure is perl Makefile.PL make make test make install COPYRIGHT AND LICENSE This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory. This is free software, licensed under: The GNU General Public License, Version 3, June 2007