xref: /openbsd/gnu/usr.bin/perl/lib/Internals.pod (revision f3efcd01)
15759b3d2Safresh1=head1 NAME
25759b3d2Safresh1
35759b3d2Safresh1Internals - Reserved special namespace for internals related functions
45759b3d2Safresh1
55759b3d2Safresh1=head1 SYNOPSIS
65759b3d2Safresh1
75759b3d2Safresh1    $is_ro= Internals::SvREADONLY($x)
85759b3d2Safresh1    $refcnt= Internals::SvREFCNT($x)
95759b3d2Safresh1    hv_clear_placeholders(%hash);
105759b3d2Safresh1
115759b3d2Safresh1=head1 DESCRIPTION
125759b3d2Safresh1
135759b3d2Safresh1The Internals namespace is used by the core Perl development team to
145759b3d2Safresh1expose certain low level internals routines for testing and other purposes.
155759b3d2Safresh1
165759b3d2Safresh1In theory these routines were not and are not intended to be used outside
175759b3d2Safresh1of the perl core, and are subject to change and removal at any time.
185759b3d2Safresh1
195759b3d2Safresh1In practice people have come to depend on these over the years, despite
205759b3d2Safresh1being historically undocumented, so we will provide some level of
215759b3d2Safresh1forward compatibility for some time. Nevertheless you can assume that any
225759b3d2Safresh1routine documented here is experimental or deprecated and you should find
235759b3d2Safresh1alternatives to their use.
245759b3d2Safresh1
255759b3d2Safresh1=head2 FUNCTIONS
265759b3d2Safresh1
275759b3d2Safresh1=over 4
285759b3d2Safresh1
295759b3d2Safresh1=item SvREFCNT(THING [, $value])
305759b3d2Safresh1
315759b3d2Safresh1Historically Perl has been a refcounted language. This means that each
325759b3d2Safresh1variable tracks how many things reference it, and when the variable is no
335759b3d2Safresh1longer referenced it will automatically free itself. In theory Perl code
345759b3d2Safresh1should not have to care about this, and in a future version Perl might
355759b3d2Safresh1change to some other strategy, although in practice this is unlikely.
365759b3d2Safresh1
375759b3d2Safresh1This function allows one to violate the abstraction of variables and get
385759b3d2Safresh1or set the refcount of a variable, and in generally is really only useful
395759b3d2Safresh1in code that is testing refcount behavior.
405759b3d2Safresh1
415759b3d2Safresh1*NOTE* You are strongly discouraged from using this function in non-test
425759b3d2Safresh1code and especially discouraged from using the set form of this function.
435759b3d2Safresh1The results of doing so may result in segmentation faults or other undefined
445759b3d2Safresh1behavior.
455759b3d2Safresh1
465759b3d2Safresh1=item SvREADONLY(THING, [, $value])
475759b3d2Safresh1
485759b3d2Safresh1Set or get whether a variable is readonly or not. Exactly what the
495759b3d2Safresh1readonly flag means depend on the type of the variable affected and the
505759b3d2Safresh1version of perl used.
515759b3d2Safresh1
525759b3d2Safresh1You are strongly discouraged from using this function directly. It is used
535759b3d2Safresh1by various core modules, like C<Hash::Util>, and the C<constant> pragma
545759b3d2Safresh1to implement higher-level behavior which should be used instead.
555759b3d2Safresh1
565759b3d2Safresh1See the core implementation for the exact meaning of the readonly flag for
575759b3d2Safresh1each internal variable type.
585759b3d2Safresh1
595759b3d2Safresh1=item hv_clear_placeholders(%hash)
605759b3d2Safresh1
615759b3d2Safresh1Clear any placeholders from a locked hash. Should not be used directly.
62*f3efcd01Safresh1You should use the wrapper functions provided by Hash::Util instead.
635759b3d2Safresh1As of 5.25 also available as C< Hash::Util::_clear_placeholders(%hash) >
645759b3d2Safresh1
655759b3d2Safresh1=back
665759b3d2Safresh1
675759b3d2Safresh1=head1 AUTHOR
685759b3d2Safresh1
695759b3d2Safresh1Perl core development team.
705759b3d2Safresh1
715759b3d2Safresh1=head1 SEE ALSO
725759b3d2Safresh1
735759b3d2Safresh1L<perlguts>
745759b3d2Safresh1L<Hash::Util>
755759b3d2Safresh1L<constant>
765759b3d2Safresh1universal.c
775759b3d2Safresh1
785759b3d2Safresh1=cut
79