NAME

Tie::Array::RestrictUpdates - Limit the number of times you change elements in an array.

SYNOPSIS

use Tie::Array::RestrictUpdates;

tie @foo,"Tie::Array::RestrictUpdates",1;
# Default limit is 1.
# Every element from the array can only be changed once
@foo = qw(A B C D E);
for(0..4) { $foo[$_] = lc $foo[$_]; }
print join("-",@foo);
# This will print A-B-C-D-E and a bunch of warnings

-or-

use Tie::Array::RestrictUpdates;

tie @foo,"Tie::Array::RestrictUpdates",[1,2,3,4];
# This forces the limits of the first 3 indexes
# This also forces any extra elements from the array to have a 0 limit
# and therefor be unchangable/unsettable
@foo = qw(A B C D E);
for(0..3) { $foo[$_] = lc $foo[$_]; }
for(0..3) { $foo[$_] = uc $foo[$_]; }
for(0..3) { $foo[$_] = lc $foo[$_]; }
for(0..3) { $foo[$_] = uc $foo[$_]; }
print join("-",@foo);
# This will print A-b-C-d and a bunch of warnings

DESCRIPTION

This module limits the number of times a value can be stored in a array.

TODO

Loads probably. This is a very early draft.

DISCLAIMER

This code is released under GPL (GNU Public License). More information can be found on http://www.gnu.org/copyleft/gpl.html

VERSION

This is Tie::Array::RestrictUpdates 0.0.1.

AUTHOR

Hendrik Van Belleghem (beatnik@quickndirty.org)

SEE ALSO

GNU & GPL - http://www.gnu.org/copyleft/gpl.html