Readonly version 1.01
=====================

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.
    They can be overridden by subsequent "use constant" directives.

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


DEVELOPMENT STATE

No bugs have been reported, or suggestions received, for the past six
months.  This either means that the module is good as-is, or that
nobody in the world is using it.  :-) Either way, it's safe to change
the version number to 1.00 and call it "released".

I am considering adding a Readonly "attribute" for use with the
Attribute::Handlers module.  Other than that, which would be optional
(perhaps a separate module), no additions or changes to this module
are planned at this time.


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.


COPYRIGHT AND LICENSE

Eric J. Roode, sdn@comcast.net

Copyright (c) 2001-2003 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.
