The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Readonly version 1.03
=====================

CHANGES FROM VERSION 1.02  (See "Changes" file for details)

o Syntax of Readonly() function has changed, for users of
  Perl 5.8 and later.


DESCRIPTION

Readonly.pm provides a facility for creating non-modifiable scalars,
arrays, and hashes.

Perl provides a built-in mechanism (the "use constant" pragma) to
create constant scalars and lists.  That mechanism has several
limitations, however:

    It creates only scalars and arrays (not hashes).
    It creates "variables" that have no leading $ or @ character.
    The variables it creates cannot be interpolated into strings.
    It works only at compile time.
    The variables it creates are global, never lexical.
    Sometimes you have to be careful with your syntax when using them
        (for example, when using one as a hash key).
    You can't pass these constants around like variables (for example,
        you can't take references to them).
    It is rather difficult to make and use complex data structures with
        use constant.
    "use constant" directives can be overridden by subsequent "use
        constant" directives. (this does generate a warning).

Readonly.pm, by contrast:

    Creates scalars, arrays (not lists), and hashes.
    Creates variables that look and work like native perl variables.
    Creates global or lexical variables.
    Works at runtime or compile time.
    Works with deep or shallow data structures.
    Prevents reassignment of Readonly variables.

EXAMPLES OF USE

    Readonly::Scalar $x => "A string value";
    Readonly::Array  @x => (1, 2, 3, 4);
    Readonly::Hash   %x => (key1 => 'value1', key2 => 'value2');

If the program subsequently tries to modify $x, @x, or %x, the program
will die with an error message.

Deep structures are a breeze:

    Readonly::Hash %x => {key1 => [1, 2], key2 => [3, 4, 5]};
    print $x{key1}[1];

Try that with "use constant"!

INSTALLATION

To install this module, do the standard Perl module four-step:

   perl Makefile.PL    or    perl Makefile.pl LIB='my/install/path'
   make
   make test
   make install


DEPENDENCIES

Test::Harness and Test::More, if you want to run the test suites (and
yes, you should).  Also, Carp.pm and Exporter.pm, but they come with
Perl.

Readonly::XS (available on CPAN) is a companion module to Readonly.
If that module is present, Readonly will use it for handling scalars.
This results in a significant speed improvement.  This is transparent
to your code; whether or not the XS module is present, Readonly works
the same.


COPYRIGHT AND LICENSE

Eric J. Roode, roode@cpan.org

Copyright (c) 2001-2004 by Eric J. Roode. All Rights Reserved.  This module
is free software; you can redistribute it and/or modify it under the
same terms as Perl itself.

If you have suggestions for improvement, please drop me a line.  If
you make improvements to this software, I ask that you please send me
a copy of your changes. Thanks.