Array-Lock
view release on metacpan or search on metacpan
lock_values (@array);
unlock_values (@array, @indexes);
Locks and unlocks index value pairs in an array. If no set of indexes is
specified, then all current indexes are locked.
=cut
sub lock_values (\@;@) {
my($array,@indexes) = @_;
Internals::SvREADONLY $array->[$_], 1 for @indexes ? @indexes : $[.. $#{$array};
}
sub unlock_values (\@;@) {
my($array,@indexes) = @_;
Internals::SvREADONLY $array->[$_], 0 for @indexes ? @indexes : $[.. $#{$array};
}
=item B<lock_array>
=item B<unlock_array>
lock_array(@array);
lock_array() locks an entire array, making all indexes and values readonly.
No value can be changed, no indexes can be added or deleted.
( run in 0.645 second using v1.01-cache-2.11-cpan-b61123c0432 )