.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Internals 3pm" .TH Internals 3pm 2024-01-10 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Internals \- Write\-protect variables, manipulate refcounts .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Internals qw(IsWriteProtected SetReadOnly SetReadWrite GetRefCount SetRefCount); \& \& use Internals qw(:all); \& \& $object = My::Class\->new(@parameters); \& \& SetReadOnly($object); \& \& SetReadWrite($object); \& \& if (IsWriteProtected($object)) { ... } \& \& $value = GetRefCount($object); \& \& SetRefCount($object,$value); .Ve .PP or .PP .Vb 1 \& package My::Class; \& \& use Internals; \& \& @ISA = qw(Internals); \& \& $object = My::Class\->new(@parameters)\->SetReadOnly(); \& \& $object\->SetReadWrite(); \& \& if ($object\->IsWriteProtected()) { ... } \& \& $value = $object\->GetRefCount(); \& \& $object\->SetRefCount($value); .Ve .PP or .PP .Vb 1 \& use Internals qw(IsWriteProtected SetReadOnly SetReadWrite GetRefCount SetRefCount); \& \& use Internals qw(:all); \& \& SetReadOnly(\e$scalar); \& \& SetReadOnly(\e@array); \& \& SetReadOnly(\e%hash); \& \& SetReadOnly(\e$hash{$element}); \& \& SetReadOnly(\e$reference); .Ve .PP etc. .SH DESCRIPTION .IX Header "DESCRIPTION" This module allows you to write-protect and write-enable your Perl variables, objects and data structures. .PP Moreover, the reference count of any Perl variable can be read and set. .PP You can never pass the object directly on which to perform the desired action, you always have to pass a reference to the variable or data structure in question. .PP This comes in handy for objects and anonymous data structures, where you only have a reference anyway! .PP BEWARE: This module is DANGEROUS! .PP DO NOT attempt to unlock Perl's built-in variables! .PP DO NOT manipulate reference counts unless you know exactly what you're doing! .PP ANYTHING might happen! Hell might break loose! \f(CW\*(C`:\-)\*(C'\fR .PP YOU HAVE BEEN WARNED! .SH VERSION .IX Header "VERSION" This man page documents "Internals" version 1.1. .SH AUTHOR .IX Header "AUTHOR" .Vb 3 \& Steffen Beyer \& mailto:sb@engelschall.com \& http://www.engelschall.com/u/sb/download/ .Ve .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (c) 2001 by Steffen Beyer. All rights reserved. .SH LICENSE .IX Header "LICENSE" This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e., under the terms of the "Artistic License" or the "GNU General Public License". .PP Please refer to the files "Artistic.txt" and "GNU_GPL.txt" in this distribution for details! .SH DISCLAIMER .IX Header "DISCLAIMER" This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .PP See the "GNU General Public License" for more details.