Debian Codegraph @

upstream/opensuse-tumbleweed/man3/Tie::RefHash.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 "Tie::RefHash 3pm"
61 .TH Tie::RefHash 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 Tie::RefHash \- Use references as hash keys
68 .SH VERSION
69 .IX Header "VERSION"
70 version 1.41
71 .SH SYNOPSIS
72 .IX Header "SYNOPSIS"
73 .Vb 4
74 \& require 5.004;
75 \& use Tie::RefHash;
76 \& tie HASHVARIABLE, \*(AqTie::RefHash\*(Aq, LIST;
77 \& tie HASHVARIABLE, \*(AqTie::RefHash::Nestable\*(Aq, LIST;
78 \&
79 \& untie HASHVARIABLE;
80 .Ve
81 .SH DESCRIPTION
82 .IX Header "DESCRIPTION"
83 This module provides the ability to use references as hash keys if you
84 first \f(CW\*(C`tie\*(C'\fR the hash variable to this module. Normally, only the
85 keys of the tied hash itself are preserved as references; to use
86 references as keys in hashes\-of\-hashes, use Tie::RefHash::Nestable,
87 included as part of Tie::RefHash.
88 .PP
89 It is implemented using the standard perl TIEHASH interface. Please
90 see the \f(CW\*(C`tie\*(C'\fR entry in \fBperlfunc\fR\|(1) and \fBperltie\fR\|(1) for more information.
91 .PP
92 The Nestable version works by looking for hash references being stored
93 and converting them to tied hashes so that they too can have
94 references as keys. This will happen without warning whenever you
95 store a reference to one of your own hashes in the tied hash.
96 .SH EXAMPLE
97 .IX Header "EXAMPLE"
98 .Vb 10
99 \& use Tie::RefHash;
100 \& tie %h, \*(AqTie::RefHash\*(Aq;
101 \& $a = [];
102 \& $b = {};
103 \& $c = \e*main;
104 \& $d = \e"gunk";
105 \& $e = sub { \*(Aqfoo\*(Aq };
106 \& %h = ($a => 1, $b => 2, $c => 3, $d => 4, $e => 5);
107 \& $a\->[0] = \*(Aqfoo\*(Aq;
108 \& $b\->{foo} = \*(Aqbar\*(Aq;
109 \& for (keys %h) {
110 \& print ref($_), "\en";
111 \& }
112 \&
113 \& tie %h, \*(AqTie::RefHash::Nestable\*(Aq;
114 \& $h{$a}\->{$b} = 1;
115 \& for (keys %h, keys %{$h{$a}}) {
116 \& print ref($_), "\en";
117 \& }
118 .Ve
119 .SH "THREAD SUPPORT"
120 .IX Header "THREAD SUPPORT"
121 Tie::RefHash fully supports threading using the \f(CW\*(C`CLONE\*(C'\fR method.
122 .SH "STORABLE SUPPORT"
123 .IX Header "STORABLE SUPPORT"
124 Storable hooks are provided for semantically correct serialization and
125 cloning of tied refhashes.
126 .SH "SEE ALSO"
127 .IX Header "SEE ALSO"
128 \&\fBperl\fR\|(1), \fBperlfunc\fR\|(1), \fBperltie\fR\|(1)
129 .SH SUPPORT
130 .IX Header "SUPPORT"
131 Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=Tie-RefHash>
132 (or bug\-Tie\[email protected] <mailto:[email protected]>).
133 .SH AUTHORS
134 .IX Header "AUTHORS"
135 Gurusamy Sarathy <[email protected]>
136 .PP
137 Tie::RefHash::Nestable by Ed Avis <[email protected]>
138 .SH CONTRIBUTORS
139 .IX Header "CONTRIBUTORS"
140 .IP \(bu 4
141 Yuval Kogman <[email protected]>
142 .IP \(bu 4
143 Karen Etheridge <[email protected]>
144 .IP \(bu 4
145 Florian Ragwitz <[email protected]>
146 .IP \(bu 4
147 Lukas Mai <[email protected]>
148 .IP \(bu 4
149 Jerry D. Hedden <[email protected]>
150 .IP \(bu 4
151 tusooa <[email protected]>
152 .SH "COPYRIGHT AND LICENCE"
153 .IX Header "COPYRIGHT AND LICENCE"
154 This software is copyright (c) 2006 by יובל קוג\*(Aqמן (Yuval Kogman) <[email protected]>.
155 .PP
156 This is free software; you can redistribute it and/or modify it under
157 the same terms as the Perl 5 programming language system itself.