1Hash::Case(3)         User Contributed Perl Documentation        Hash::Case(3)
2
3
4

NAME

6       Hash::Case - base class for hashes with key-casing requirements
7

INHERITANCE

9        Hash::Case
10          is a Tie::StdHash
11
12        Hash::Case is extended by
13          Hash::Case::Lower
14          Hash::Case::Preserve
15          Hash::Case::Upper
16

SYNOPSIS

18        use Hash::Case::Lower;
19        tie my(%lchash), 'Hash::Case::Lower';
20        $lchash{StraNGeKeY} = 3;
21        print keys %lchash;  # strangekey
22

DESCRIPTION

24       Hash::Case is the base class for various classes which tie special
25       treatment for the casing of keys.  Be aware of the differences in
26       implementation: "Lower" and "Upper" are tied native hashes: these
27       hashes have no need for hidden fields or other assisting data
28       structured.  A case "Preserve" hash will actually create three hashes.
29
30       The following strategies are implemented:
31
32       ·   Hash::Case::Lower (native hash)
33
34           Keys are always considered lower case. The internals of this module
35           translate any incoming key to lower case before it is used.
36
37       ·   Hash::Case::Upper (native hash)
38
39           Like the ::Lower, but then all keys are always translated into
40           upper case.  This module can be of use for some databases, which do
41           translate everything to capitals as well.  To avoid confusion, you
42           may want to have you own internal Perl hash do this as well.
43
44       ·   Hash::Case::Preserve
45
46           The actual casing is ignored, but not forgotten.
47

METHODS

49       $obj->addHashData(HASH)
50
51           Add the data of a hash (passed as reference) to the created tied
52           hash.  The existing values in the hash remain, the keys are adapted
53           to the needs of the the casing.
54
55       $obj->addPairs(PAIRS)
56
57           Specify an even length list of alternating key and value to be
58           stored in the hash.
59
60       $obj->setHash(HASH)
61
62           The functionality differs for native and wrapper hashes.  For
63           native hashes, this is the same as first clearing the hash, and
64           then a call to addHashData.  Wrapper hashes will use the hash you
65           specify here to store the data, and re-create the mapping hash.
66
67       tie(HASH, TIE, [VALUES,] OPTIONS)
68
69           Tie the HASH with the TIE package which extends Hash::Case.  The
70           OPTIONS differ per implementation: read the manual page for the
71           package you actually use.  The VALUES is a reference to an array
72           containing key-value pairs, or a reference to a hash: they fill the
73           initial hash.
74
75           example:
76
77            my %x;
78            tie %x, 'Hash::Case::Lower';
79            $x{Upper} = 3;
80            print keys %x;       # 'upper'
81
82            my @y = (ABC => 3, DeF => 4);
83            tie %x, 'Hash::Case::Lower', \@y;
84            print keys %x;       # 'abc' 'def'
85
86            my %z = (ABC => 3, DeF => 4);
87            tie %x, 'Hash::Case::Lower', \%z;
88

SEE ALSO

90       This module is part of Hash-Case distribution version 1.006, built on
91       June 19, 2008. Website: http://perl.overmeer.net/hash-case/
92

LICENSE

94       Copyrights 2002-2003,2007-2008 by Mark Overmeer. For other contributors
95       see ChangeLog.
96
97       This program is free software; you can redistribute it and/or modify it
98       under the same terms as Perl itself.  See
99       http://www.perl.com/perl/misc/Artistic.html
100
101
102
103perl v5.12.0                      2008-06-19                     Hash::Case(3)
Impressum