1XS(3)                 User Contributed Perl Documentation                XS(3)
2
3
4

NAME

6       Readonly::XS - Companion module for Readonly.pm, to speed up read-only
7       scalar variables.
8

VERSION

10       This document describes version 1.05 of Readonly::XS, February 24,
11       2009.
12

SYNOPSIS

14         Install this module, but do not use it.
15

DESCRIPTION

17       The Readonly module (q.v.) is an effective way to create non-modifiable
18       variables.  However, it's relatively slow.
19
20       The reason it's slow is that is implements the read-only-ness of
21       variables via tied objects.  This mechanism is inherently slow.  Perl
22       simply has to do a lot of work under the hood to make tied variables
23       work.
24
25       This module corrects the speed problem, at least with respect to scalar
26       variables.  When Readonly::XS is installed, Readonly uses it to access
27       the internals of scalar variables.  Instead of creating a scalar
28       variable object and tying it, Readonly simply flips the SvREADONLY bit
29       in the scalar's FLAGS structure.
30
31       Readonly arrays and hashes are not sped up by this, since the
32       SvREADONLY flag only works for scalars.  Arrays and hashes always use
33       the tie interface.
34
35       Why implement this as a separate module?  Because not everyone can use
36       XS.  Not everyone has a C compiler.  Also, installations with a
37       statically-linked perl may not want to recompile their perl binary just
38       for this module.  Rather than render Readonly.pm useless for
39        these people, the XS portion was put into a separate module.
40
41       Programs that you write do not need to know whether Readonly::XS is
42       installed or not.  They should just "use Readonly" and let Readonly
43       worry about whether or not it can use XS.  If the Readonly::XS is
44       present, Readonly will be faster.  If not, it won't.  Either way, it
45       will still work, and your code will not have to change.
46
47       Your program can check whether Readonly.pm is using XS or not by
48       examining the $Readonly::XSokay variable.  It will be true if the XS
49       module was found and is being used.  Please do not change this
50       variable.
51
52   EXPORTS
53       None.
54

SEE ALSO

56       Readonly.pm
57
59       Eric Roode, roode@cpan.org
60
61       Copyright (c) 2003-2009 by Eric J. Roode. All Rights Reserved.  This
62       module is free software; you can redistribute it and/or modify it under
63       the same terms as Perl itself.
64
65       To avoid my spam filter, please include "Perl", "module", or this
66       module's name in the message's subject line, and/or GPG-sign your
67       message.
68
69
70
71perl v5.34.0                      2021-07-22                             XS(3)
Impressum