Debian Codegraph @

upstream/opensuse-tumbleweed/man3/Hash::Util.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "Hash::Util 3pm"
61 .TH Hash::Util 3pm 2026-03-09 "perl v5.42.1" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 Hash::Util \- A selection of general\-utility hash subroutines
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 .Vb 1
71 \& # Restricted hashes
72 \&
73 \& use Hash::Util qw(
74 \& fieldhash fieldhashes
75 \&
76 \& all_keys
77 \& lock_keys unlock_keys
78 \& lock_value unlock_value
79 \& lock_hash unlock_hash
80 \& lock_keys_plus
81 \& hash_locked hash_unlocked
82 \& hashref_locked hashref_unlocked
83 \& hidden_keys legal_keys
84 \&
85 \& lock_ref_keys unlock_ref_keys
86 \& lock_ref_value unlock_ref_value
87 \& lock_hashref unlock_hashref
88 \& lock_ref_keys_plus
89 \& hidden_ref_keys legal_ref_keys
90 \&
91 \& hash_seed hash_value hv_store
92 \& bucket_stats bucket_info bucket_array
93 \& lock_hash_recurse unlock_hash_recurse
94 \& lock_hashref_recurse unlock_hashref_recurse
95 \&
96 \& hash_traversal_mask
97 \& );
98 \&
99 \& my %hash = (foo => 42, bar => 23);
100 \& # Ways to restrict a hash
101 \& lock_keys(%hash);
102 \& lock_keys(%hash, @keyset);
103 \& lock_keys_plus(%hash, @additional_keys);
104 \&
105 \& # Ways to inspect the properties of a restricted hash
106 \& my @legal = legal_keys(%hash);
107 \& my @hidden = hidden_keys(%hash);
108 \& my $ref = all_keys(%hash,@keys,@hidden);
109 \& my $is_locked = hash_locked(%hash);
110 \&
111 \& # Remove restrictions on the hash
112 \& unlock_keys(%hash);
113 \&
114 \& # Lock individual values in a hash
115 \& lock_value (%hash, \*(Aqfoo\*(Aq);
116 \& unlock_value(%hash, \*(Aqfoo\*(Aq);
117 \&
118 \& # Ways to change the restrictions on both keys and values
119 \& lock_hash (%hash);
120 \& unlock_hash(%hash);
121 \&
122 \& my $hashes_are_randomised = hash_seed() !~ /^\e0+$/;
123 \&
124 \& my $int_hash_value = hash_value( \*(Aqstring\*(Aq );
125 \&
126 \& my $mask= hash_traversal_mask(%hash);
127 \&
128 \& hash_traversal_mask(%hash,1234);
129 .Ve
130 .SH DESCRIPTION
131 .IX Header "DESCRIPTION"
132 \&\f(CW\*(C`Hash::Util\*(C'\fR and \f(CW\*(C`Hash::Util::FieldHash\*(C'\fR contain special functions
133 for manipulating hashes that don\*(Aqt really warrant a keyword.
134 .PP
135 \&\f(CW\*(C`Hash::Util\*(C'\fR contains a set of functions that support
136 restricted hashes. These are described in
137 this document. \f(CW\*(C`Hash::Util::FieldHash\*(C'\fR contains an (unrelated)
138 set of functions that support the use of hashes in
139 \&\fIinside\-out classes\fR, described in Hash::Util::FieldHash.
140 .PP
141 By default \f(CW\*(C`Hash::Util\*(C'\fR does not export anything.
142 .SS "Restricted hashes"
143 .IX Subsection "Restricted hashes"
144 5.8.0 introduces the ability to restrict a hash to a certain set of
145 keys. No keys outside of this set can be added. It also introduces
146 the ability to lock an individual key so it cannot be deleted and the
147 ability to ensure that an individual value cannot be changed.
148 .PP
149 This is intended to largely replace the deprecated pseudo\-hashes.
150 .IP \fBlock_keys\fR 4
151 .IX Item "lock_keys"
152 .PD 0
153 .IP \fBunlock_keys\fR 4
154 .IX Item "unlock_keys"
155 .PD
156 .Vb 2
157 \& lock_keys(%hash);
158 \& lock_keys(%hash, @keys);
159 .Ve
160 .Sp
161 Restricts the given \f(CW%hash\fR\*(Aqs set of keys to \f(CW@keys\fR. If \f(CW@keys\fR is not
162 given it restricts it to its current keyset. No more keys can be
163 added. \fBdelete()\fR and \fBexists()\fR will still work, but will not alter
164 the set of allowed keys. \fBNote\fR: the current implementation prevents
165 the hash from being \fBbless()\fRed while it is in a locked state. Any attempt
166 to do so will raise an exception. Of course you can still \fBbless()\fR
167 the hash before you call \fBlock_keys()\fR so this shouldn\*(Aqt be a problem.
168 .Sp
169 .Vb 1
170 \& unlock_keys(%hash);
171 .Ve
172 .Sp
173 Removes the restriction on the \f(CW%hash\fR\*(Aqs keyset.
174 .Sp
175 \&\fBNote\fR that if any of the values of the hash have been locked they will not
176 be unlocked after this sub executes.
177 .Sp
178 Both routines return a reference to the hash operated on.
179 .IP \fBlock_keys_plus\fR 4
180 .IX Item "lock_keys_plus"
181 .Vb 1
182 \& lock_keys_plus(%hash,@additional_keys)
183 .Ve
184 .Sp
185 Similar to \f(CWlock_keys()\fR, with the difference being that the optional key list
186 specifies keys that may or may not be already in the hash. Essentially this is
187 an easier way to say
188 .Sp
189 .Vb 1
190 \& lock_keys(%hash,@additional_keys,keys %hash);
191 .Ve
192 .Sp
193 Returns a reference to \f(CW%hash\fR
194 .IP \fBlock_value\fR 4
195 .IX Item "lock_value"
196 .PD 0
197 .IP \fBunlock_value\fR 4
198 .IX Item "unlock_value"
199 .PD
200 .Vb 2
201 \& lock_value (%hash, $key);
202 \& unlock_value(%hash, $key);
203 .Ve
204 .Sp
205 Locks and unlocks the value for an individual key of a hash. The value of a
206 locked key cannot be changed.
207 .Sp
208 Unless \f(CW%hash\fR has already been locked the key/value could be deleted
209 regardless of this setting.
210 .Sp
211 Returns a reference to the \f(CW%hash\fR.
212 .IP \fBlock_hash\fR 4
213 .IX Item "lock_hash"
214 .PD 0
215 .IP \fBunlock_hash\fR 4
216 .IX Item "unlock_hash"
217 .PD
218 .Vb 1
219 \& lock_hash(%hash);
220 .Ve
221 .Sp
222 \&\fBlock_hash()\fR locks an entire hash, making all keys and values read\-only.
223 No value can be changed, no keys can be added or deleted.
224 .Sp
225 .Vb 1
226 \& unlock_hash(%hash);
227 .Ve
228 .Sp
229 \&\fBunlock_hash()\fR does the opposite of \fBlock_hash()\fR. All keys and values
230 are made writable. All values can be changed and keys can be added
231 and deleted.
232 .Sp
233 Returns a reference to the \f(CW%hash\fR.
234 .IP \fBlock_hash_recurse\fR 4
235 .IX Item "lock_hash_recurse"
236 .PD 0
237 .IP \fBunlock_hash_recurse\fR 4
238 .IX Item "unlock_hash_recurse"
239 .PD
240 .Vb 1
241 \& lock_hash_recurse(%hash);
242 .Ve
243 .Sp
244 \&\fBlock_hash()\fR locks an entire hash and any hashes it references recursively,
245 making all keys and values read\-only. No value can be changed, no keys can
246 be added or deleted.
247 .Sp
248 This method \fBonly\fR recurses into hashes that are referenced by another hash.
249 Thus a Hash of Hashes (HoH) will all be restricted, but a Hash of Arrays of
250 Hashes (HoAoH) will only have the top hash restricted.
251 .Sp
252 .Vb 1
253 \& unlock_hash_recurse(%hash);
254 .Ve
255 .Sp
256 \&\fBunlock_hash_recurse()\fR does the opposite of \fBlock_hash_recurse()\fR. All keys and
257 values are made writable. All values can be changed and keys can be added
258 and deleted. Identical recursion restrictions apply as to \fBlock_hash_recurse()\fR.
259 .Sp
260 Returns a reference to the \f(CW%hash\fR.
261 .IP \fBhashref_locked\fR 4
262 .IX Item "hashref_locked"
263 .PD 0
264 .IP \fBhash_locked\fR 4
265 .IX Item "hash_locked"
266 .PD
267 .Vb 2
268 \& hashref_locked(\e%hash) and print "Hash is locked!\en";
269 \& hash_locked(%hash) and print "Hash is locked!\en";
270 .Ve
271 .Sp
272 Returns true if the hash and its keys are locked.
273 .IP \fBhashref_unlocked\fR 4
274 .IX Item "hashref_unlocked"
275 .PD 0
276 .IP \fBhash_unlocked\fR 4
277 .IX Item "hash_unlocked"
278 .PD
279 .Vb 2
280 \& hashref_unlocked(\e%hash) and print "Hash is unlocked!\en";
281 \& hash_unlocked(%hash) and print "Hash is unlocked!\en";
282 .Ve
283 .Sp
284 Returns true if the hash and its keys are unlocked.
285 .IP \fBlegal_keys\fR 4
286 .IX Item "legal_keys"
287 .Vb 1
288 \& my @keys = legal_keys(%hash);
289 .Ve
290 .Sp
291 Returns the list of the keys that are legal in a restricted hash.
292 In the case of an unrestricted hash this is identical to calling
293 keys(%hash).
294 .IP \fBhidden_keys\fR 4
295 .IX Item "hidden_keys"
296 .Vb 1
297 \& my @keys = hidden_keys(%hash);
298 .Ve
299 .Sp
300 Returns the list of the keys that are legal in a restricted hash but
301 do not have a value associated to them. Thus if \*(Aqfoo\*(Aq is a
302 "hidden" key of the \f(CW%hash\fR it will return false for both \f(CW\*(C`defined\*(C'\fR
303 and \f(CW\*(C`exists\*(C'\fR tests.
304 .Sp
305 In the case of an unrestricted hash this will return an empty list.
306 .Sp
307 \&\fBNOTE\fR this is an experimental feature that is heavily dependent
308 on the current implementation of restricted hashes. Should the
309 implementation change, this routine may become meaningless, in which
310 case it will return an empty list.
311 .IP \fBall_keys\fR 4
312 .IX Item "all_keys"
313 .Vb 1
314 \& all_keys(%hash,@keys,@hidden);
315 .Ve
316 .Sp
317 Populates the arrays \f(CW@keys\fR with the all the keys that would pass
318 an \f(CW\*(C`exists\*(C'\fR tests, and populates \f(CW@hidden\fR with the remaining legal
319 keys that have not been utilized.
320 .Sp
321 Returns a reference to the hash.
322 .Sp
323 In the case of an unrestricted hash this will be equivalent to
324 .Sp
325 .Vb 5
326 \& $ref = do {
327 \& @keys = keys %hash;
328 \& @hidden = ();
329 \& \e%hash
330 \& };
331 .Ve
332 .Sp
333 \&\fBNOTE\fR this is an experimental feature that is heavily dependent
334 on the current implementation of restricted hashes. Should the
335 implementation change this routine may become meaningless in which
336 case it will behave identically to how it would behave on an
337 unrestricted hash.
338 .IP \fBhash_seed\fR 4
339 .IX Item "hash_seed"
340 .Vb 1
341 \& my $hash_seed = hash_seed();
342 .Ve
343 .Sp
344 \&\fBhash_seed()\fR returns the seed bytes used to randomise hash ordering.
345 .Sp
346 \&\fBNote that the hash seed is sensitive information\fR: by knowing it one
347 can craft a denial\-of\-service attack against Perl code, even remotely,
348 see "Algorithmic Complexity Attacks" in perlsec for more information.
349 \&\fBDo not disclose the hash seed\fR to people who don\*(Aqt need to know it.
350 See also "PERL_HASH_SEED_DEBUG" in perlrun.
351 .Sp
352 Prior to Perl 5.17.6 this function returned a UV, it now returns a string,
353 which may be of nearly any size as determined by the hash function your
354 Perl has been built with. Possible sizes may be but are not limited to
355 4 bytes (for most hash algorithms) and 16 bytes (for siphash).
356 .IP \fBhash_value\fR 4
357 .IX Item "hash_value"
358 .Vb 2
359 \& my $hash_value = hash_value($string);
360 \& my $hash_value = hash_value($string, $seed);
361 .Ve
362 .Sp
363 \&\f(CWhash_value($string)\fR
364 returns
365 the current perl\*(Aqs internal hash value for a given string.
366 \&\f(CW\*(C`hash_value($string, $seed)\*(C'\fR
367 returns the hash value as if computed with a different seed.
368 If the custom seed is too short, the function errors out.
369 The minimum length of the seed is implementation\-dependent.
370 .Sp
371 Returns a 32\-bit integer
372 representing the hash value of the string passed in.
373 The 1\-parameter value is only reliable
374 for the lifetime of the process.
375 It may be different
376 depending on invocation, environment variables, perl version,
377 architectures, and build options.
378 .Sp
379 \&\fBNote that the hash value of a given string is sensitive information\fR:
380 by knowing it one can deduce the hash seed which in turn can allow one to
381 craft a denial\-of\-service attack against Perl code, even remotely,
382 see "Algorithmic Complexity Attacks" in perlsec for more information.
383 \&\fBDo not disclose the hash value of a string\fR to people who don\*(Aqt need to
384 know it. See also "PERL_HASH_SEED_DEBUG" in perlrun.
385 .IP \fBbucket_info\fR 4
386 .IX Item "bucket_info"
387 Return a set of basic information about a hash.
388 .Sp
389 .Vb 1
390 \& my ($keys, $buckets, $used, @length_counts)= bucket_info($hash);
391 .Ve
392 .Sp
393 Fields are as follows:
394 .Sp
395 .Vb 5
396 \& 0: Number of keys in the hash
397 \& 1: Number of buckets in the hash
398 \& 2: Number of used buckets in the hash
399 \& rest : list of counts, Kth element is the number of buckets
400 \& with K keys in it.
401 .Ve
402 .Sp
403 See also \fBbucket_stats()\fR and \fBbucket_array()\fR.
404 .IP \fBbucket_stats\fR 4
405 .IX Item "bucket_stats"
406 Returns a list of statistics about a hash.
407 .Sp
408 .Vb 3
409 \& my ($keys, $buckets, $used, $quality, $utilization_ratio,
410 \& $collision_pct, $mean, $stddev, @length_counts)
411 \& = bucket_stats($hashref);
412 .Ve
413 .Sp
414 Fields are as follows:
415 .Sp
416 .Vb 10
417 \& 0: Number of keys in the hash
418 \& 1: Number of buckets in the hash
419 \& 2: Number of used buckets in the hash
420 \& 3: Hash Quality Score
421 \& 4: Percent of buckets used
422 \& 5: Percent of keys which are in collision
423 \& 6: Mean bucket length of occupied buckets
424 \& 7: Standard Deviation of bucket lengths of occupied buckets
425 \& rest : list of counts, Kth element is the number of buckets
426 \& with K keys in it.
427 .Ve
428 .Sp
429 See also \fBbucket_info()\fR and \fBbucket_array()\fR.
430 .Sp
431 Note that Hash Quality Score would be 1 for an ideal hash, numbers
432 close to and below 1 indicate good hashing, and number significantly
433 above indicate a poor score. In practice it should be around 0.95 to 1.05.
434 It is defined as:
435 .Sp
436 .Vb 4
437 \& $score= sum( $count[$length] * ($length * ($length + 1) / 2) )
438 \& /
439 \& ( ( $keys / 2 * $buckets ) *
440 \& ( $keys + ( 2 * $buckets ) \- 1 ) )
441 .Ve
442 .Sp
443 The formula is from the Red Dragon book (reformulated to use the data available)
444 and is documented at <http://www.strchr.com/hash_functions>
445 .IP \fBbucket_array\fR 4
446 .IX Item "bucket_array"
447 .Vb 1
448 \& my $array= bucket_array(\e%hash);
449 .Ve
450 .Sp
451 Returns a packed representation of the bucket array associated with a hash. Each element
452 of the array is either an integer K, in which case it represents K empty buckets, or
453 a reference to another array which contains the keys that are in that bucket.
454 .Sp
455 \&\fBNote that the information returned by bucket_array is sensitive information\fR:
456 by knowing it one can directly attack perl\*(Aqs hash function which in turn may allow
457 one to craft a denial\-of\-service attack against Perl code, even remotely,
458 see "Algorithmic Complexity Attacks" in perlsec for more information.
459 \&\fBDo not disclose the output of this function\fR to people who don\*(Aqt need to
460 know it. See also "PERL_HASH_SEED_DEBUG" in perlrun. This function is provided strictly
461 for debugging and diagnostics purposes only, it is hard to imagine a reason why it
462 would be used in production code.
463 .IP \fBbucket_stats_formatted\fR 4
464 .IX Item "bucket_stats_formatted"
465 .Vb 1
466 \& print bucket_stats_formatted($hashref);
467 .Ve
468 .Sp
469 Return a formatted report of the information returned by \fBbucket_stats()\fR.
470 An example report looks like this:
471 .Sp
472 .Vb 12
473 \& Keys: 50 Buckets: 33/64 Quality\-Score: 1.01 (Good)
474 \& Utilized Buckets: 51.56% Optimal: 78.12% Keys In Collision: 34.00%
475 \& Chain Length \- mean: 1.52 stddev: 0.66
476 \& Buckets 64 [0000000000000000000000000000000111111111111111111122222222222333]
477 \& Len 0 Pct: 48.44 [###############################]
478 \& Len 1 Pct: 29.69 [###################]
479 \& Len 2 Pct: 17.19 [###########]
480 \& Len 3 Pct: 4.69 [###]
481 \& Keys 50 [11111111111111111111111111111111122222222222222333]
482 \& Pos 1 Pct: 66.00 [#################################]
483 \& Pos 2 Pct: 28.00 [##############]
484 \& Pos 3 Pct: 6.00 [###]
485 .Ve
486 .Sp
487 The first set of stats gives some summary statistical information,
488 including the quality score translated into "Good", "Poor" and "Bad",
489 (score<=1.05, score<=1.2, score>1.2). See the documentation in
490 \&\fBbucket_stats()\fR for more details.
491 .Sp
492 The two sets of barcharts give stats and a visual indication of performance
493 of the hash.
494 .Sp
495 The first gives data on bucket chain lengths and provides insight on how
496 much work a fetch *miss* will take. In this case we have to inspect every item
497 in a bucket before we can be sure the item is not in the list. The performance
498 for an insert is equivalent to this case, as is a delete where the item
499 is not in the hash.
500 .Sp
501 The second gives data on how many keys are at each depth in the chain, and
502 gives an idea of how much work a fetch *hit* will take. The performance for
503 an update or delete of an item in the hash is equivalent to this case.
504 .Sp
505 Note that these statistics are summary only. Actual performance will depend
506 on real hit/miss ratios accessing the hash. If you are concerned by hit ratios
507 you are recommended to "oversize" your hash by using something like:
508 .Sp
509 .Vb 1
510 \& keys(%hash)= keys(%hash) << $k;
511 .Ve
512 .Sp
513 With \f(CW$k\fR chosen carefully, and likely to be a small number like 1 or 2. In
514 theory the larger the bucket array the less chance of collision.
515 .IP \fBhv_store\fR 4
516 .IX Item "hv_store"
517 .Vb 4
518 \& my $sv = 0;
519 \& hv_store(%hash,$key,$sv) or die "Failed to alias!";
520 \& $hash{$key} = 1;
521 \& print $sv; # prints 1
522 .Ve
523 .Sp
524 Stores an alias to a variable in a hash instead of copying the value.
525 .IP \fBhash_traversal_mask\fR 4
526 .IX Item "hash_traversal_mask"
527 As of Perl 5.18 every hash has its own hash traversal order, and this order
528 changes every time a new element is inserted into the hash. This functionality
529 is provided by maintaining an unsigned integer mask (U32) which is xor\*(Aqed
530 with the actual bucket id during a traversal of the hash buckets using \fBkeys()\fR,
531 \&\fBvalues()\fR or \fBeach()\fR.
532 .Sp
533 You can use this subroutine to get and set the traversal mask for a specific
534 hash. Setting the mask ensures that a given hash will produce the same key
535 order. \fBNote\fR that this does \fBnot\fR guarantee that \fBtwo\fR hashes will produce
536 the same key order for the same hash seed and traversal mask, items that
537 collide into one bucket may have different orders regardless of this setting.
538 .IP \fBbucket_ratio\fR 4
539 .IX Item "bucket_ratio"
540 This function behaves the same way that scalar(%hash) behaved prior to
541 Perl 5.25. Specifically if the hash is tied, then it calls the SCALAR tied
542 hash method, if untied then if the hash is empty it return 0, otherwise it
543 returns a string containing the number of used buckets in the hash,
544 followed by a slash, followed by the total number of buckets in the hash.
545 .Sp
546 .Vb 2
547 \& my %hash=("foo"=>1);
548 \& print Hash::Util::bucket_ratio(%hash); # prints "1/8"
549 .Ve
550 .IP \fBused_buckets\fR 4
551 .IX Item "used_buckets"
552 This function returns the count of used buckets in the hash. It is expensive
553 to calculate and the value is NOT cached, so avoid use of this function
554 in production code.
555 .IP \fBnum_buckets\fR 4
556 .IX Item "num_buckets"
557 This function returns the total number of buckets the hash holds, or would
558 hold if the array were created. (When a hash is freshly created the array
559 may not be allocated even though this value will be non\-zero.)
560 .SS "Operating on references to hashes"
561 .IX Subsection "Operating on references to hashes"
562 Most subroutines documented in this module have equivalent versions
563 that operate on references to hashes instead of native hashes.
564 The following is a list of these subs. They are identical except
565 in name and in that instead of taking a \f(CW%hash\fR they take a \f(CW$hashref\fR,
566 and additionally are not prototyped.
567 .IP lock_ref_keys 4
568 .IX Item "lock_ref_keys"
569 .PD 0
570 .IP unlock_ref_keys 4
571 .IX Item "unlock_ref_keys"
572 .IP lock_ref_keys_plus 4
573 .IX Item "lock_ref_keys_plus"
574 .IP lock_ref_value 4
575 .IX Item "lock_ref_value"
576 .IP unlock_ref_value 4
577 .IX Item "unlock_ref_value"
578 .IP lock_hashref 4
579 .IX Item "lock_hashref"
580 .IP unlock_hashref 4
581 .IX Item "unlock_hashref"
582 .IP lock_hashref_recurse 4
583 .IX Item "lock_hashref_recurse"
584 .IP unlock_hashref_recurse 4
585 .IX Item "unlock_hashref_recurse"
586 .IP hash_ref_unlocked 4
587 .IX Item "hash_ref_unlocked"
588 .IP legal_ref_keys 4
589 .IX Item "legal_ref_keys"
590 .IP hidden_ref_keys 4
591 .IX Item "hidden_ref_keys"
592 .PD
593 .SH CAVEATS
594 .IX Header "CAVEATS"
595 Note that the trapping of the restricted operations is not atomic:
596 for example
597 .PP
598 .Vb 1
599 \& eval { %hash = (illegal_key => 1) }
600 .Ve
601 .PP
602 leaves the \f(CW%hash\fR empty rather than with its original contents.
603 .SH BUGS
604 .IX Header "BUGS"
605 The interface exposed by this module is very close to the current
606 implementation of restricted hashes. Over time it is expected that
607 this behavior will be extended and the interface abstracted further.
608 .SH AUTHOR
609 .IX Header "AUTHOR"
610 Michael G Schwern <[email protected]> on top of code by Nick
611 Ing\-Simmons and Jeffrey Friedl.
612 .PP
613 \&\fBhv_store()\fR is from Array::RefElem, Copyright 2000 Gisle Aas.
614 .PP
615 Additional code by Yves Orton.
616 .PP
617 Description of \f(CW\*(C`hash_value($string, $seed)\*(C'\fR
618 by Christopher Yeleighton <[email protected]>
619 .SH "SEE ALSO"
620 .IX Header "SEE ALSO"
621 Scalar::Util, List::Util and "Algorithmic Complexity Attacks" in perlsec.
622 .PP
623 Hash::Util::FieldHash.