I've uploaded a proposed module, Tie::StrictHash, into my directory on
CPAN:

$CPAN/authors/id/K/KV/KVAIL/Tie-StrictHash-1.0.tar.gz

It implements 'strict'-like semantics on hashes.  I looked into
Tie::SecureHash, but it seemed like overkill for what I wanted, which
was just a simple way to use hash members as instance variables in an
object without worrying about mistyping one.

One creates a strict hash by using the call:

strict_hash %hash, key1 => value1, ...;

This creates %hash with the given keys.  If the hash had any data before
the strict_hash call, it will have that data as well.

To add a key, use the return value from strict_hash (or call "tied
%hash") and use the 'add' method; to delete one, use the 'delete'
method; to clear the entire hash, use the 'clear' method.  That's it. 
You can request that accesses to hash keys that don't exist, read or
write, be treated as fatal errors or just as warnings, and you can have
the output include a stack trace if you like.  These are controlled by
the options on the 'use' statement.  Full POD included in the module.

Information for the module list (if this gets added there):

Name             DSLI  Abstract
---------------  ----  --------------------------------------------
Tie::StrictHash  RdpO  A hash with 'strict'-like semantics

Sincerely,
Kevin Michael Vail
[EMAIL PROTECTED]
[EMAIL PROTECTED]

Reply via email to