.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "Hash::Case 3" .TH Hash::Case 3 2026-02-05 "perl v5.42.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Hash::Case \- base class for hashes with key\-casing requirements .SH INHERITANCE .IX Header "INHERITANCE" .Vb 2 \& Hash::Case \& is a Tie::StdHash \& \& Hash::Case is extended by \& Hash::Case::Lower \& Hash::Case::Preserve \& Hash::Case::Upper .Ve .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 4 \& use Hash::Case::Lower; \& tie my(%lchash), \*(AqHash::Case::Lower\*(Aq; \& $lchash{StraNGeKeY} = 3; \& print keys %lchash; # strangekey \& \& (tied %lchash)\->addPairs(key => value, ...); \& (tied %lchash)\->addHashData(\e%data); \& (tied %lchash)\->setHash(\e%replacement); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Hash::Case is the base class for various classes which tie special treatment for the casing of keys. Be aware of the differences in implementation: \f(CW\*(C`Lower\*(C'\fR and \f(CW\*(C`Upper\*(C'\fR are tied native hashes: these hashes have no need for hidden fields or other assisting data structured. A case \f(CW\*(C`Preserve\*(C'\fR hash will actually create three hashes. .PP The following strategies are implemented: .IP \(bu 4 Hash::Case::Lower (native hash) .Sp Keys are always considered lower case. The internals of this module translate any incoming key to lower case before it is used. .IP \(bu 4 Hash::Case::Upper (native hash) .Sp 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. .IP \(bu 4 Hash::Case::Preserve .Sp The actual casing is ignored, but not forgotten. .SH METHODS .IX Header "METHODS" .SS Constructors .IX Subsection "Constructors" .ie n .IP "tie \fR\fB%hash\fR\fB\fR, $class, [$values,] %options" 4 .el .IP "tie \fR\f(CB%hash\fR\fB\fR, \f(CW$class\fR, [$values,] \f(CW%options\fR" 4 .IX Item "tie %hash, $class, [$values,] %options" Tie the \f(CW%hash\fR with the \f(CW$class\fR (package which extends Hash::Case). The \f(CW%options\fR differ per implementation: read the manual page for the package you actually use. The optional \f(CW$values\fR is a reference to an ARRAY (containing key\-value PAIRS) or a HASH: they fill\-in the initial \f(CW%hash\fR. .Sp ยป example: .Sp .Vb 4 \& my %x; \& tie %x, \*(AqHash::Case::Lower\*(Aq; \& $x{Upper} = 3; \& print keys %x; # \*(Aqupper\*(Aq \& \& my @y = (ABC => 3, DeF => 4); \& tie %x, \*(AqHash::Case::Lower\*(Aq, \e@y; \& print keys %x; # \*(Aqabc\*(Aq \*(Aqdef\*(Aq \& \& my %z = (ABC => 3, DeF => 4); \& tie %x, \*(AqHash::Case::Lower\*(Aq, \e%z; .Ve .SS "Hidden object access" .IX Subsection "Hidden object access" Besides all the usual HASH actions which are implemented for the tied \&\f(CW%hash\fR, you can also call methods on the \f(CWtied()\fR object. .ie n .IP $obj\->\fBaddHashData\fR(\e%data) 4 .el .IP \f(CW$obj\fR\->\fBaddHashData\fR(\e%data) 4 .IX Item "$obj->addHashData(%data)" Add the \f(CW%data\fR to the created tied hash. The existing values in the hash remain, the keys are adapted to the needs of the the casing. .ie n .IP $obj\->\fBaddPairs\fR(@pairs) 4 .el .IP \f(CW$obj\fR\->\fBaddPairs\fR(@pairs) 4 .IX Item "$obj->addPairs(@pairs)" Specify an even length list of alternating key and value to be stored in the hash. .ie n .IP $obj\->\fBsetHash\fR(\e%data) 4 .el .IP \f(CW$obj\fR\->\fBsetHash\fR(\e%data) 4 .IX Item "$obj->setHash(%data)" The functionality differs for native and wrapper hashes. For native hashes, this is the same as first clearing the hash, and then a call to \fBaddHashData()\fR. Wrapper hashes will use the hash you specify here to store the data, and re\-create the mapping hash. .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of Hash\-Case version 1.07, built on January 26, 2026. Website: \fIhttp://perl.overmeer.net/CPAN/\fR .SH LICENSE .IX Header "LICENSE" For contributors see file ChangeLog. .PP This software is copyright (c) 2002\-2026 by Mark Overmeer. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.