Tie::Array::RestrictUpdates - Limit the number of times you change elements in an array.
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
This module limits the number of times a value can be stored in a array.
Loads probably. This is a very early draft.
This code is released under GPL (GNU Public License). More information can be found on http://www.gnu.org/copyleft/gpl.html
This is Tie::Array::RestrictUpdates 0.0.1.
Hendrik Van Belleghem (beatnik@quickndirty.org)
GNU & GPL - http://www.gnu.org/copyleft/gpl.html
To install Tie::Array::RestrictUpdates, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tie::Array::RestrictUpdates
CPAN shell
perl -MCPAN -e shell install Tie::Array::RestrictUpdates
For more information on module installation, please visit the detailed CPAN module installation guide.