CHips L MINI SHELL

CHips L pro

Current Path : /proc/self/root/proc/2/root/usr/local/share/man/man3/
Upload File :
Current File : //proc/self/root/proc/2/root/usr/local/share/man/man3/Readonly.3pm

.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" 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
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'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 turned on, 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.
.ie \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.el \{\
.    de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Readonly 3pm"
.TH Readonly 3pm "2016-06-10" "perl v5.10.1" "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"
Readonly \- Facility for creating read\-only scalars, arrays, hashes
.SH "Synopsis"
.IX Header "Synopsis"
.Vb 1
\&    use Readonly;
\&
\&    # Deep Read\-only scalar
\&    Readonly::Scalar    $sca => $initial_value;
\&    Readonly::Scalar my $sca => $initial_value;
\&
\&    # Deep Read\-only array
\&    Readonly::Array    @arr => @values;
\&    Readonly::Array my @arr => @values;
\&
\&    # Deep Read\-only hash
\&    Readonly::Hash    %has => (key => value, key => value, ...);
\&    Readonly::Hash my %has => (key => value, key => value, ...);
\&    # or:
\&    Readonly::Hash    %has => {key => value, key => value, ...};
\&
\&    # You can use the read\-only variables like any regular variables:
\&    print $sca;
\&    $something = $sca + $arr[2];
\&    next if $has{$some_key};
\&
\&    # But if you try to modify a value, your program will die:
\&    $sca = 7;
\&    push @arr, \*(Aqseven\*(Aq;
\&    delete $has{key};
\&    # The error message is "Modification of a read\-only value attempted"
\&
\&    # Alternate form (Perl 5.8 and later)
\&    Readonly    $sca => $initial_value;
\&    Readonly my $sca => $initial_value;
\&    Readonly    @arr => @values;
\&    Readonly my @arr => @values;
\&    Readonly    %has => (key => value, key => value, ...);
\&    Readonly my %has => (key => value, key => value, ...);
\&    Readonly my $sca; # Implicit undef, readonly value
\&
\&    # Alternate form (for Perls earlier than v5.8)
\&    Readonly    \e$sca => $initial_value;
\&    Readonly \emy $sca => $initial_value;
\&    Readonly    \e@arr => @values;
\&    Readonly \emy @arr => @values;
\&    Readonly    \e%has => (key => value, key => value, ...);
\&    Readonly \emy %has => (key => value, key => value, ...);
.Ve
.SH "Description"
.IX Header "Description"
This is a facility for creating non-modifiable variables. This is useful for
configuration files, headers, etc. It can also be useful as a development and
debugging tool for catching updates to variables that should not be changed.
.SH "Variable Depth"
.IX Header "Variable Depth"
Readonly has the ability to create both deep and shallow readonly variables.
.PP
If you pass a \f(CW$ref\fR, an \f(CW@array\fR or a \f(CW%hash\fR to corresponding functions
\&\f(CW\*(C`::Scalar()\*(C'\fR, \f(CW\*(C`::Array()\*(C'\fR and \f(CW\*(C`::Hash()\*(C'\fR, then those functions recurse over
the data structure, marking everything as readonly. The entire structure is
then non-modifiable. This is normally what you want.
.PP
If you want only the top level to be readonly, use the alternate (and poorly
named) \f(CW\*(C`::Scalar1()\*(C'\fR, \f(CW\*(C`::Array1()\*(C'\fR, and \f(CW\*(C`::Hash1()\*(C'\fR functions.
.PP
Plain \f(CW\*(C`Readonly()\*(C'\fR creates what the original author calls a \*(L"shallow\*(R"
readonly variable, which is great if you don't plan to use it on anything but
only one dimensional scalar values.
.PP
\&\f(CW\*(C`Readonly::Scalar()\*(C'\fR makes the variable 'deeply' readonly, so the following
snippet kills over as you expect:
.PP
.Vb 1
\& use Readonly;
\&
\& Readonly::Scalar my $ref => { 1 => \*(Aqa\*(Aq };
\& $ref\->{1} = \*(Aqb\*(Aq;
\& $ref\->{2} = \*(Aqb\*(Aq;
.Ve
.PP
While the following snippet does \fBnot\fR make your structure 'deeply' readonly:
.PP
.Vb 1
\& use Readonly;
\&
\& Readonly my $ref => { 1 => \*(Aqa\*(Aq };
\& $ref\->{1} = \*(Aqb\*(Aq;
\& $ref\->{2} = \*(Aqb\*(Aq;
.Ve
.SH ""
.IX Header ""
.SH "The Past"
.IX Header "The Past"
The following sections are updated versions of the previous authors
documentation.
.ie n .SS "Comparison with ""use constant"""
.el .SS "Comparison with ``use constant''"
.IX Subsection "Comparison with use constant"
Perl provides a facility for creating constant values, via the constant
pragma. There are several problems with this pragma.
.IP "\(bu" 2
The constants created have no leading sigils.
.IP "\(bu" 2
These constants cannot be interpolated into strings.
.IP "\(bu" 2
Syntax can get dicey sometimes.  For example:
.Sp
.Vb 3
\&    use constant CARRAY => (2, 3, 5, 7, 11, 13);
\&    $a_prime = CARRAY[2];        # wrong!
\&    $a_prime = (CARRAY)[2];      # right \-\- MUST use parentheses
.Ve
.IP "\(bu" 2
You have to be very careful in places where barewords are allowed.
.Sp
For example:
.Sp
.Vb 4
\&    use constant SOME_KEY => \*(Aqkey\*(Aq;
\&    %hash = (key => \*(Aqvalue\*(Aq, other_key => \*(Aqother_value\*(Aq);
\&    $some_value = $hash{SOME_KEY};        # wrong!
\&    $some_value = $hash{+SOME_KEY};       # right
.Ve
.Sp
(who thinks to use a unary plus when using a hash to scalarize the key?)
.IP "\(bu" 2
\&\f(CW\*(C`use constant\*(C'\fR works for scalars and arrays, not hashes.
.IP "\(bu" 2
These constants are global to the package in which they're declared;
cannot be lexically scoped.
.IP "\(bu" 2
Works only at compile time.
.IP "\(bu" 2
Can be overridden:
.Sp
.Vb 3
\&    use constant PI => 3.14159;
\&    ...
\&    use constant PI => 2.71828;
.Ve
.Sp
(this does generate a warning, however, if you have warnings enabled).
.IP "\(bu" 2
It is very difficult to make and use deep structures (complex data
structures) with \f(CW\*(C`use constant\*(C'\fR.
.SH "Comparison with typeglob constants"
.IX Header "Comparison with typeglob constants"
Another popular way to create read-only scalars is to modify the symbol table
entry for the variable by using a typeglob:
.PP
.Vb 1
\&    *a = \e\*(Aqvalue\*(Aq;
.Ve
.PP
This works fine, but it only works for global variables (\*(L"my\*(R" variables have
no symbol table entry). Also, the following similar constructs do \fBnot\fR work:
.PP
.Vb 2
\&    *a = [1, 2, 3];      # Does NOT create a read\-only array
\&    *a = { a => \*(AqA\*(Aq};    # Does NOT create a read\-only hash
.Ve
.SS "Pros"
.IX Subsection "Pros"
Readonly.pm, on the other hand, will work with global variables and with
lexical (\*(L"my\*(R") variables. It will create scalars, arrays, or hashes, all of
which look and work like normal, read-write Perl variables. You can use them
in scalar context, in list context; you can take references to them, pass them
to functions, anything.
.PP
Readonly.pm also works well with complex data structures, allowing you to tag
the whole structure as nonmodifiable, or just the top level.
.PP
Also, Readonly variables may not be reassigned. The following code will die:
.PP
.Vb 3
\&    Readonly::Scalar $pi => 3.14159;
\&    ...
\&    Readonly::Scalar $pi => 2.71828;
.Ve
.SS "Cons"
.IX Subsection "Cons"
Readonly.pm used to impose a performance penalty. It was pretty slow. How
slow? Run the \f(CW\*(C`eg/benchmark.pl\*(C'\fR script that comes with Readonly. On my test
system, \*(L"use constant\*(R" (const), typeglob constants (tglob), regular read/write
Perl variables (normal/literal), and the new Readonly (ro/ro_simple) are all
about the same speed, the old, tie based Readonly.pm constants were about 1/22
the speed.
.PP
However, there is relief. There is a companion module available, Readonly::XS.
You won't need this if you're using Perl 5.8.x or higher.
.PP
I repeat, you do not need Readonly::XS if your environment has perl 5.8.x or
higher. Please see section entitled Internals for more.
.SH "Functions"
.IX Header "Functions"
.ie n .IP "Readonly::Scalar $var => $value;" 4
.el .IP "Readonly::Scalar \f(CW$var\fR => \f(CW$value\fR;" 4
.IX Item "Readonly::Scalar $var => $value;"
Creates a nonmodifiable scalar, \f(CW$var\fR, and assigns a value of \f(CW$value\fR to
it. Thereafter, its value may not be changed. Any attempt to modify the value
will cause your program to die.
.Sp
A value \fImust\fR be supplied. If you want the variable to have \f(CW\*(C`undef\*(C'\fR as its
value, you must specify \f(CW\*(C`undef\*(C'\fR.
.Sp
If \f(CW$value\fR is a reference to a scalar, array, or hash, then this function
will mark the scalar, array, or hash it points to as being Readonly as well,
and it will recursively traverse the structure, marking the whole thing as
Readonly. Usually, this is what you want. However, if you want only the
\&\f(CW$value\fR marked as Readonly, use \f(CW\*(C`Scalar1\*(C'\fR.
.Sp
If \f(CW$var\fR is already a Readonly variable, the program will die with an error
about reassigning Readonly variables.
.ie n .IP "Readonly::Array @arr => (value, value, ...);" 4
.el .IP "Readonly::Array \f(CW@arr\fR => (value, value, ...);" 4
.IX Item "Readonly::Array @arr => (value, value, ...);"
Creates a nonmodifiable array, \f(CW@arr\fR, and assigns the specified list of
values to it. Thereafter, none of its values may be changed; the array may not
be lengthened or shortened or spliced. Any attempt to do so will cause your
program to die.
.Sp
If any of the values passed is a reference to a scalar, array, or hash, then
this function will mark the scalar, array, or hash it points to as being
Readonly as well, and it will recursively traverse the structure, marking the
whole thing as Readonly. Usually, this is what you want. However, if you want
only the hash \f(CW%@arr\fR itself marked as Readonly, use \f(CW\*(C`Array1\*(C'\fR.
.Sp
If \f(CW@arr\fR is already a Readonly variable, the program will die with an error
about reassigning Readonly variables.
.ie n .IP "Readonly::Hash %h => (key => value, key => value, ...);" 4
.el .IP "Readonly::Hash \f(CW%h\fR => (key => value, key => value, ...);" 4
.IX Item "Readonly::Hash %h => (key => value, key => value, ...);"
.PD 0
.ie n .IP "Readonly::Hash %h => {key => value, key => value, ...};" 4
.el .IP "Readonly::Hash \f(CW%h\fR => {key => value, key => value, ...};" 4
.IX Item "Readonly::Hash %h => {key => value, key => value, ...};"
.PD
Creates a nonmodifiable hash, \f(CW%h\fR, and assigns the specified keys and values
to it. Thereafter, its keys or values may not be changed. Any attempt to do so
will cause your program to die.
.Sp
A list of keys and values may be specified (with parentheses in the synopsis
above), or a hash reference may be specified (curly braces in the synopsis
above). If a list is specified, it must have an even number of elements, or
the function will die.
.Sp
If any of the values is a reference to a scalar, array, or hash, then this
function will mark the scalar, array, or hash it points to as being Readonly
as well, and it will recursively traverse the structure, marking the whole
thing as Readonly. Usually, this is what you want. However, if you want only
the hash \f(CW%h\fR itself marked as Readonly, use \f(CW\*(C`Hash1\*(C'\fR.
.Sp
If \f(CW%h\fR is already a Readonly variable, the program will die with an error
about reassigning Readonly variables.
.ie n .IP "Readonly $var => $value;" 4
.el .IP "Readonly \f(CW$var\fR => \f(CW$value\fR;" 4
.IX Item "Readonly $var => $value;"
.PD 0
.ie n .IP "Readonly @arr => (value, value, ...);" 4
.el .IP "Readonly \f(CW@arr\fR => (value, value, ...);" 4
.IX Item "Readonly @arr => (value, value, ...);"
.ie n .IP "Readonly %h => (key => value, ...);" 4
.el .IP "Readonly \f(CW%h\fR => (key => value, ...);" 4
.IX Item "Readonly %h => (key => value, ...);"
.ie n .IP "Readonly %h => {key => value, ...};" 4
.el .IP "Readonly \f(CW%h\fR => {key => value, ...};" 4
.IX Item "Readonly %h => {key => value, ...};"
.ie n .IP "Readonly $var;" 4
.el .IP "Readonly \f(CW$var\fR;" 4
.IX Item "Readonly $var;"
.PD
The \f(CW\*(C`Readonly\*(C'\fR function is an alternate to the \f(CW\*(C`Scalar\*(C'\fR, \f(CW\*(C`Array\*(C'\fR, and
\&\f(CW\*(C`Hash\*(C'\fR functions. It has the advantage (if you consider it an advantage) of
being one function. That may make your program look neater, if you're
initializing a whole bunch of constants at once. You may or may not prefer
this uniform style.
.Sp
It has the disadvantage of having a slightly different syntax for versions of
Perl prior to 5.8.  For earlier versions, you must supply a backslash, because
it requires a reference as the first parameter.
.Sp
.Vb 4
\&    Readonly \e$var => $value;
\&    Readonly \e@arr => (value, value, ...);
\&    Readonly \e%h   => (key => value, ...);
\&    Readonly \e%h   => {key => value, ...};
.Ve
.Sp
You may or may not consider this ugly.
.Sp
Note that you can create implicit undefined variables with this function like
so \f(CW\*(C`Readonly my $var;\*(C'\fR while a verbose undefined value must be passed to the
standard \f(CW\*(C`Scalar\*(C'\fR, \f(CW\*(C`Array\*(C'\fR, and \f(CW\*(C`Hash\*(C'\fR functions.
.ie n .IP "Readonly::Scalar1 $var => $value;" 4
.el .IP "Readonly::Scalar1 \f(CW$var\fR => \f(CW$value\fR;" 4
.IX Item "Readonly::Scalar1 $var => $value;"
.PD 0
.ie n .IP "Readonly::Array1 @arr => (value, value, ...);" 4
.el .IP "Readonly::Array1 \f(CW@arr\fR => (value, value, ...);" 4
.IX Item "Readonly::Array1 @arr => (value, value, ...);"
.ie n .IP "Readonly::Hash1 %h => (key => value, key => value, ...);" 4
.el .IP "Readonly::Hash1 \f(CW%h\fR => (key => value, key => value, ...);" 4
.IX Item "Readonly::Hash1 %h => (key => value, key => value, ...);"
.ie n .IP "Readonly::Hash1 %h => {key => value, key => value, ...};" 4
.el .IP "Readonly::Hash1 \f(CW%h\fR => {key => value, key => value, ...};" 4
.IX Item "Readonly::Hash1 %h => {key => value, key => value, ...};"
.PD
These alternate functions create shallow Readonly variables, instead of deep
ones. For example:
.Sp
.Vb 2
\&    Readonly::Array1 @shal => (1, 2, {perl=>\*(AqRules\*(Aq, java=>\*(AqBites\*(Aq}, 4, 5);
\&    Readonly::Array  @deep => (1, 2, {perl=>\*(AqRules\*(Aq, java=>\*(AqBites\*(Aq}, 4, 5);
\&
\&    $shal[1] = 7;           # error
\&    $shal[2]{APL}=\*(AqWeird\*(Aq;  # Allowed! since the hash isn\*(Aqt Readonly
\&    $deep[1] = 7;           # error
\&    $deep[2]{APL}=\*(AqWeird\*(Aq;  # error, since the hash is Readonly
.Ve
.SH "Cloning"
.IX Header "Cloning"
When cloning using Storable or Clone you will notice that the value stays
readonly, which is correct. If you want to clone the value without copying the
readonly flag, use the \f(CW\*(C`Clone\*(C'\fR function:
.PP
.Vb 5
\&    Readonly::Scalar my $scalar => {qw[this that]};
\&    # $scalar\->{\*(Aqeh\*(Aq} = \*(Aqfoo\*(Aq; # Modification of a read\-only value attempted
\&    my $scalar_clone = Readonly::Clone $scalar;
\&    $scalar_clone\->{\*(Aqeh\*(Aq} = \*(Aqfoo\*(Aq;
\&    # $scalar_clone is now {this => \*(Aqthat\*(Aq, eh => \*(Aqfoo\*(Aq};
.Ve
.PP
The new variable (\f(CW$scalar_clone\fR) is a mutable clone of the original
\&\f(CW$scalar\fR.
.SH "Examples"
.IX Header "Examples"
These are a few very simple examples:
.SS "Scalars"
.IX Subsection "Scalars"
A plain old read-only value
.PP
.Vb 1
\&    Readonly::Scalar $a => "A string value";
.Ve
.PP
The value need not be a compile-time constant:
.PP
.Vb 1
\&    Readonly::Scalar $a => $computed_value;
.Ve
.SS "Arrays/Lists"
.IX Subsection "Arrays/Lists"
A read-only array:
.PP
.Vb 1
\&    Readonly::Array @a => (1, 2, 3, 4);
.Ve
.PP
The parentheses are optional:
.PP
.Vb 1
\&    Readonly::Array @a => 1, 2, 3, 4;
.Ve
.PP
You can use Perl's built-in array quoting syntax:
.PP
.Vb 1
\&    Readonly::Array @a => qw/1 2 3 4/;
.Ve
.PP
You can initialize a read-only array from a variable one:
.PP
.Vb 1
\&    Readonly::Array @a => @computed_values;
.Ve
.PP
A read-only array can be empty, too:
.PP
.Vb 2
\&    Readonly::Array @a => ();
\&    Readonly::Array @a;        # equivalent
.Ve
.SS "Hashes"
.IX Subsection "Hashes"
Typical usage:
.PP
.Vb 1
\&    Readonly::Hash %a => (key1 => \*(Aqvalue1\*(Aq, key2 => \*(Aqvalue2\*(Aq);
.Ve
.PP
A read-only hash can be initialized from a variable one:
.PP
.Vb 1
\&    Readonly::Hash %a => %computed_values;
.Ve
.PP
A read-only hash can be empty:
.PP
.Vb 2
\&    Readonly::Hash %a => ();
\&    Readonly::Hash %a;        # equivalent
.Ve
.PP
If you pass an odd number of values, the program will die:
.PP
.Vb 2
\&    Readonly::Hash %a => (key1 => \*(Aqvalue1\*(Aq, "value2");
\&    # This dies with "May not store an odd number of values in a hash"
.Ve
.SH "Exports"
.IX Header "Exports"
Historically, this module exports the \f(CW\*(C`Readonly\*(C'\fR symbol into the calling
program's namespace by default. The following symbols are also available for
import into your program, if you like: \f(CW\*(C`Scalar\*(C'\fR, \f(CW\*(C`Scalar1\*(C'\fR, \f(CW\*(C`Array\*(C'\fR,
\&\f(CW\*(C`Array1\*(C'\fR, \f(CW\*(C`Hash\*(C'\fR, and \f(CW\*(C`Hash1\*(C'\fR.
.SH "Internals"
.IX Header "Internals"
Some people simply do not understand the relationship between this module and
Readonly::XS so I'm adding this section. Odds are, they still won't understand
but I like to write so...
.PP
In the past, Readonly's \*(L"magic\*(R" was performed by \f(CW\*(C`tie()\*(C'\fR\-ing variables to the
\&\f(CW\*(C`Readonly::Scalar\*(C'\fR, \f(CW\*(C`Readonly::Array\*(C'\fR, and \f(CW\*(C`Readonly::Hash\*(C'\fR packages (not
to be confused with the functions of the same names) and acting on \f(CW\*(C`WRITE\*(C'\fR,
\&\f(CW\*(C`READ\*(C'\fR, et. al. While this worked well, it was slow. Very slow. Like 20\-30
times slower than accessing variables directly or using one of the other
const-related modules that have cropped up since Readonly was released in
2003.
.PP
To 'fix' this, Readonly::XS was written. If installed, Readonly::XS used the
internal methods \f(CW\*(C`SvREADONLY\*(C'\fR and \f(CW\*(C`SvREADONLY_on\*(C'\fR to lock simple scalars. On
the surface, everything was peachy but things weren't the same behind the
scenes. In edge cases, code performed very differently if Readonly::XS was
installed and because it wasn't a required dependency in most code, it made
downstream bugs very hard to track.
.PP
In the years since Readonly::XS was released, the then private internal
methods have been exposed and can be used in pure perl. Similar modules were
written to take advantage of this and a patch to Readonly was created. We no
longer need to build and install another module to make Readonly useful on
modern builds of perl.
.IP "\(bu" 4
You do not need to install Readonly::XS.
.IP "\(bu" 4
You should stop listing Readonly::XS as a dependency or expect it to
be installed.
.IP "\(bu" 4
Stop testing the \f(CW$Readonly::XSokay\fR variable!
.SH "Requirements"
.IX Header "Requirements"
Please note that most users of Readonly no longer need to install the
companion module Readonly::XS which is recommended but not required for perl
5.6.x and under. Please do not force it as a requirement in new code and do
not use the package variable \f(CW$Readonly::XSokay\fR in code/tests. For more, see
\&\*(L"Internals\*(R" in the section on Readonly's new internals.
.PP
There are no non-core requirements.
.SH "Bug Reports"
.IX Header "Bug Reports"
If email is better for you, my address is mentioned below but I
would rather have bugs sent through the issue tracker found at
http://github.com/sanko/readonly/issues.
.SH "Acknowledgements"
.IX Header "Acknowledgements"
Thanks to Slaven Rezic for the idea of one common function (Readonly) for all
three types of variables (13 April 2002).
.PP
Thanks to Ernest Lergon for the idea (and initial code) for deeply-Readonly
data structures (21 May 2002).
.PP
Thanks to Damian Conway for the idea (and code) for making the Readonly
function work a lot smoother under perl 5.8+.
.SH "Author"
.IX Header "Author"
Sanko Robinson <sanko@cpan.org> \- http://sankorobinson.com/
.PP
\&\s-1CPAN\s0 \s-1ID:\s0 \s-1SANKO\s0
.PP
Original author: Eric J. Roode, roode@cpan.org
.SH "License and Legal"
.IX Header "License and Legal"
Copyright (C) 2013\-2016 by Sanko Robinson <sanko@cpan.org>
.PP
Copyright (c) 2001\-2004 by Eric J. Roode. All Rights Reserved.
.PP
This module is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.

Copyright 2K16 - 2K18 Indonesian Hacker Rulez