Tie-Hash-ImmutableKeys version 0.01
===================================
Tie::Hash::ImmutableKeys - Perl module to create a HASH where keys are immutable but not the leaf data. It is possible to modify the key by FORCE_STORE or FORCE_DELETE. It is working on all the tree key created (keys and subkeys are immutable).
INSTALLATION
To install this module type the following:
perl Makefile.PL
make
make test
make install
DEPENDENCIES
This module requires these other modules and libraries:
Tie::StdHash
EXAMPLE
use Data::Dumper;
my $z = { aze => 100, tyuiop => 333, qsdfg => 987 };
my $f = { A => 0, Z => 1, E => 0, L => $z };
my $a = { a => 0, z => 1, e => 1, r => 1, AA => $f };
my $list = {
S => $a,
F => $f,
P => "leaf"
};
## Tie the hash with a list of key and values
tie( my %a, 'Tie::Hash::ImmutableKeys', $list );
## Try to modify a value . If the key is missing this command fail
my $ar = "z" ;
if ( defined( $a{ S }->{ $ar } = 1111 ) )
{
print "The key is present and data are updated " . Dumper( \%a );
}else
{
print "The key is NOT present and data are NOT updated " . Dumper( \%a );
}
COPYRIGHT AND LICENCE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.
Under the GNU GPL2
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program;
if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
B<Tie::Hash::ImmutableKeys> Copyright (C) 2007 DULAUNOY Fabrice. B<Tie::Hash::ImmutableKeys> comes with ABSOLUTELY NO WARRANTY;
for details See: L<http://www.gnu.org/licenses/gpl.html>
This is free software, and you are welcome to redistribute it under certain conditions;