File: README

package info (click to toggle)
libscalar-readonly-perl 0.03-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 116 kB
  • sloc: perl: 16; makefile: 10
file content (58 lines) | stat: -rw-r--r-- 1,634 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
NAME
    Scalar::Readonly - functions for controlling whether any scalar variable
    is read-only

SYNOPSIS
      use Scalar::Readonly ':all';
      my $foo = "foo";
      readonly_on($foo);
      $foo = "bar";  #ERROR!
  
      if (readonly($foo)) {
        readonly_off($foo);
      }
  
      readonly_off($]);
      $] = "6.0";
  
      print "This is Perl v$]";

DESCRIPTION
    This simple module can make scalars read-only. Useful to protect
    configuration variables, for example.

    This module can also be used to subvert Perl's many read-only variables
    to potential evil trickery.

  readonly
    Ths function takes a scalar variable and tells you whether it is
    read-only. It returns 0 if the scalar isn't read-only, and a positive
    number if it is.

  readonly_on
    Makes the passed scalar variable read-only. If you try and modify a
    read-only scalar, your code will die with the following error message:

      Modification of a read-only value attempted at

  readonly_off
    Makes the passed scalar variable read-write. You can even do this to
    read-only special variables, though you almost certainly don't want to
    do that.

  EXPORT
    ':all' => readonly, readonly_on, readonly_off

SEE ALSO
    Scalar::Util, Attribute::Constant, Const::Fast.

AUTHOR
    Philippe M. Chiasson, <gozer@cpan.org>

COPYRIGHT AND LICENSE
    Copyright (C) 2004 by Philippe M. Chiasson

    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself, either Perl version 5.8.3 or, at
    your option, any later version of Perl 5 you may have available.