The following module was proposed for inclusion in the Module List:
modid: Hash::MultiKey
DSLIP: bdprp
description: hashes whose keys can be multiple
userid: FXN (Xavier Noria)
chapterid: 6 (Data_Type_Utilities)
communities:
[EMAIL PROTECTED],comp.lang.perl.modules,freenode#Perl
similar:
Tie::ListKeyedHash
rationale:
Rationale for name: On the one hand I'd seach for "multikey" myself
if I was looking for such a module. On the other hand I see Tie:: as
putting an implementation detail in the name. I prefer the name of
my module just suggests what is about. But this can of course be
discussed to conform to any naming policy in CPAN.
Rationale for approach: Tie::ListKeyedHash uses a hard-coded nested
hash created with eval() when needed behind the scenes. As a
consequence you cannot set $hash{'foo'} = 1 and $hash{'foo','bar'} =
3, because perl tries to assign the key 'bar' to the hashref '1',
which results in an error.
In Hash::MultiKey keys can be truly multiple. For instance, in
$hash{foo} = 1; $hash{"foo", "bar"} = [0..7];
$hash{"foo","bar","baz","zoo"} = { key => "value" };
%hash has just three keys. It also accepts arrayrefs for a better
performance and to allow keys containing $;.
Since values in the internal structure are just a slot in the
corresponding tree node, the last example does NOT result in a new
key ["foo","bar","baz","zoo", "key"], %hash is standard in that
regard, it just assigns multiple-keys to scalars, as usual.
Best regards to all!
-- fxn
enteredby: FXN (Xavier Noria)
enteredon: Sun Mar 9 20:46:40 2003 GMT
The resulting entry would be:
Hash::
::MultiKey bdprp hashes whose keys can be multiple FXN
Thanks for registering,
The Pause Team
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=49300000_4bd80e5c48439901&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=49300000_4bd80e5c48439901&SUBMIT_pause99_add_mod_insertit=1