The following module was proposed for inclusion in the Module List: modid: Hash::WithDefaults DSLIP: Rdprp description: hashes fetching nonexisting items in others userid: JENDA (Jan Krynicky) chapterid: 6 (Data_Type_Utilities) communities: *@listserver.ActiveState.com, [EMAIL PROTECTED]
similar: Hash::Case rationale: This module allows you to specify the case sensitivity / mangling behaviour of hash and allows you to specify several defaults. That is other hashes in which the keys not found in the current hash are looked up: %defaults = {x => 99, a => -5}; tie %hash, 'Hash::WithDefault', 'Preserve', {a => 5, b => 10}; tied(%hash)->AddDefault(\%defaults); print "\$hash{a}=$hash{a}\n"; # prints $hash{a}=5 print "\$hash{x}=$hash{x}\n"; # prints $hash{x}=99 This is usefull if you have some configuration in a HoH (eg. read from an INI file) and want to use some sections as defaults for others: [:default] path=c:\project\files extensions=html,htm [some_section] path=c:\project\some_section interval=60 There are these case sensitivity related options: Sensitive - the hash will be case sensitive Tolower - the hash will be case sensitive, all keys are made lowercase Toupper - the hash will be case sensitive, all keys are made uppercase Preserve - the hash will be case insensitive, the case is preserved Lower - the hash will be case insensitive, all keys are made lowercase Upper - the hash will be case insensitive, all keys are made uppercase I use this module in Config::IniHash. You find the module at http://jenda.krynicky.cz/perl/index.plx?file=&dir=1&grep=%5EHash-WithDefaults (Sorry if you got this several times, the submit button doesn't seem to work.) enteredby: JENDA (Jan Krynicky) enteredon: Thu Dec 5 13:03:58 2002 GMT The resulting entry would be: Hash:: ::WithDefaults Rdprp hashes fetching nonexisting items in others JENDA 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=bd300000_bd4f88d3e6ca8e18&SUBMIT_pause99_add_mod_preview=1 Immediate (one click) registration: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=bd300000_bd4f88d3e6ca8e18&SUBMIT_pause99_add_mod_insertit=1