Debian Codegraph @

upstream/debian-unstable/man3/Internals.3perl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (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 .\"
57 .IX Title "Internals 3perl"
58 .TH Internals 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide"
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 Internals \- Reserved special namespace for internals related functions
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 4
68 \& $is_ro= Internals::SvREADONLY($x)
69 \& $refcnt= Internals::SvREFCNT($x)
70 \& hv_clear_placeholders(%hash);
71 \& if (Internals::stack_refcounted & 1) { .... }
72 .Ve
73 .SH DESCRIPTION
74 .IX Header "DESCRIPTION"
75 The Internals namespace is used by the core Perl development team to
76 expose certain low level internals routines for testing and other purposes.
77 .PP
78 In theory these routines were not and are not intended to be used outside
79 of the perl core, and are subject to change and removal at any time.
80 .PP
81 In practice people have come to depend on these over the years, despite
82 being historically undocumented, so we will provide some level of
83 forward compatibility for some time. Nevertheless you can assume that any
84 routine documented here is experimental or deprecated and you should find
85 alternatives to their use.
86 .SS FUNCTIONS
87 .IX Subsection "FUNCTIONS"
88 .ie n .IP "SvREFCNT(THING [, $value])" 4
89 .el .IP "SvREFCNT(THING [, \f(CW$value\fR])" 4
90 .IX Item "SvREFCNT(THING [, $value])"
91 Historically Perl has been a refcounted language. This means that each
92 variable tracks how many things reference it, and when the variable is no
93 longer referenced it will automatically free itself. In theory Perl code
94 should not have to care about this, and in a future version Perl might
95 change to some other strategy, although in practice this is unlikely.
96 .Sp
97 This function allows one to violate the abstraction of variables and get
98 or set the refcount of a variable, and in generally is really only useful
99 in code that is testing refcount behavior.
100 .Sp
101 *NOTE* You are strongly discouraged from using this function in non-test
102 code and especially discouraged from using the set form of this function.
103 The results of doing so may result in segmentation faults or other undefined
104 behavior.
105 .ie n .IP "SvREADONLY(THING, [, $value])" 4
106 .el .IP "SvREADONLY(THING, [, \f(CW$value\fR])" 4
107 .IX Item "SvREADONLY(THING, [, $value])"
108 Set or get whether a variable is readonly or not. Exactly what the
109 readonly flag means depend on the type of the variable affected and the
110 version of perl used.
111 .Sp
112 You are strongly discouraged from using this function directly. It is used
113 by various core modules, like \f(CW\*(C`Hash::Util\*(C'\fR, and the \f(CW\*(C`constant\*(C'\fR pragma
114 to implement higher-level behavior which should be used instead.
115 .Sp
116 See the core implementation for the exact meaning of the readonly flag for
117 each internal variable type.
118 .IP hv_clear_placeholders(%hash) 4
119 .IX Item "hv_clear_placeholders(%hash)"
120 Clear any placeholders from a locked hash. Should not be used directly.
121 You should use the wrapper functions provided by Hash::Util instead.
122 As of 5.25 also available as \f(CW Hash::Util::_clear_placeholders(%hash) \fR
123 .IP stack_refcounted 4
124 .IX Item "stack_refcounted"
125 Returns an integer indicating whether the perl binary has been configured
126 and built with an argument stack which reference-counts any items pushed
127 onto it. The value should be treated as flag bits. Currently only bit 0 is
128 used, indicating that \f(CW\*(C`PERL_RC_STACK\*(C'\fR was enabled during the build.
129 .SH AUTHOR
130 .IX Header "AUTHOR"
131 Perl core development team.
132 .SH "SEE ALSO"
133 .IX Header "SEE ALSO"
134 perlguts
135 Hash::Util
136 constant
137 universal.c