Lines Matching refs:hash

16 Hash::Util - A selection of general-utility hash subroutines
25 %hash = (foo => 42, bar => 23);
26 lock_keys(%hash);
27 lock_keys(%hash, @keyset);
28 unlock_keys(%hash);
30 lock_value (%hash, 'foo');
31 unlock_value(%hash, 'foo');
33 lock_hash (%hash);
34 unlock_hash(%hash);
47 5.8.0 introduces the ability to restrict a hash to a certain set of
60 lock_keys(%hash);
61 lock_keys(%hash, @keys);
63 Restricts the given %hash's set of keys to @keys. If @keys is not
67 the hash from being bless()ed while it is in a locked state. Any attempt
69 the hash before you call lock_keys() so this shouldn't be a problem.
71 unlock_keys(%hash);
73 Removes the restriction on the %hash's keyset.
78 my($hash, @keys) = @_;
80 Internals::hv_clear_placeholders %$hash;
83 my %original_keys = map { ($_ => 1) } keys %$hash;
91 $hash->{$k} = undef unless exists $hash->{$k};
93 Internals::SvREADONLY %$hash, 1;
96 delete $hash->{$k} unless $original_keys{$k};
100 Internals::SvREADONLY %$hash, 1;
107 my($hash) = shift;
109 Internals::SvREADONLY %$hash, 0;
117 lock_value (%hash, $key);
118 unlock_value(%hash, $key);
120 Locks and unlocks an individual key of a hash. The value of a locked
123 %hash must have already been locked for this to have useful effect.
128 my($hash, $key) = @_;
129 carp "Cannot usefully lock values in an unlocked hash"
130 unless Internals::SvREADONLY %$hash;
131 Internals::SvREADONLY $hash->{$key}, 1;
135 my($hash, $key) = @_;
136 Internals::SvREADONLY $hash->{$key}, 0;
144 lock_hash(%hash);
146 lock_hash() locks an entire hash, making all keys and values readonly.
149 unlock_hash(%hash);
158 my($hash) = shift;
160 lock_keys(%$hash);
162 foreach my $key (keys %$hash) {
163 lock_value(%$hash, $key);
170 my($hash) = shift;
172 foreach my $key (keys %$hash) {
173 unlock_value(%$hash, $key);
176 unlock_keys(%$hash);
186 hash_seed() returns the seed number used to randomise hash ordering.
187 Zero means the "traditional" random hash ordering, non-zero means the
188 new even more random hash ordering introduced in Perl 5.8.1.
190 B<Note that the hash seed is sensitive information>: by knowing it one
193 B<Do not disclose the hash seed> to people who don't need to know it.
209 eval { %hash = (illegal_key => 1) }
211 leaves the C<%hash> empty rather than with its original contents.