NAME
Hash::Case - base class for hashes with key-casing requirements
CLASS HIERARCHY
Hash::Case
is a Tie::StdHash
is a Tie::Hash
SYNOPSIS
use Hash::Case::Lower;
tie my(%lchash), 'Hash::Case::Lower';
$lchash{StraNGeKeY} = 3;
print keys %lchash; # strangekey
DESCRIPTION
Hash::Case is the base class for various classes which tie special treatment for the casing of keys. The following strategies are implemented:
Hash::Case::Lower
Keys are always considered lower case. The internals of this module translate any incoming key to lower case before it is used.
Hash::Case::Upper
Like the ::Lower, but then all keys are always translated into upper case. This module can be of use for some databases, which do translate everything to capitals as well. To avoid confusion, you may want to have you own internal Perl hash do this as well.
Hash::Case::Preserve
The actual casing is ignored, but not forgotten.
METHODS
- tie HASH, TIE, [VALUES,] OPTIONS
-
Tie the HASH with the TIE package which extends Hash::Case. The OPTIONS differ per implementation: read the manual page for the package you actually use. The VALUES is a reference to an array containing key-value pairs, or a reference to a hash: they fill the initial hash.
Examples:
my %x; tie %x, 'Hash::Case::Lower'; $x{Upper} = 3; print keys %x; # 'upper' my @y = (ABC => 3, DeF => 4); tie %x, 'Hash::Case::Lower', \@y; print keys %x; # 'abc' 'def' my %z = (ABC => 3, DeF => 4); tie %x, 'Hash::Case::Lower', \%z;
SEE ALSO
Hash::Case::Lower Hash::Case::Upper Hash::Case::Preserve
AUTHOR
Mark Overmeer (mark@overmeer.net). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
VERSION
This code is beta, version 1.002
Copyright (c) 2002 Mark Overmeer. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 112:
You forgot a '=back' before '=head1'