Tie::Hash::KeysMask

Tie::Hash::KeysMask - control key aliasing by mask function, e.g. omit case of character distinction.
Download

Tie::Hash::KeysMask Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Josef Schnbrunner
  • Publisher web site:
  • http://search.cpan.org/~schoejo/Tie-Hash-KeysMask-0.01/lib/Tie/Hash/KeysMask.pm

Tie::Hash::KeysMask Tags


Tie::Hash::KeysMask Description

Tie::Hash::KeysMask - control key aliasing by mask function, e.g. omit case of character distinction. Tie::Hash::KeysMask - control key aliasing by mask function, e.g. omit case of character distinction.SYNOPSIS use Tie::Hash::KeysMask; my $mask = sub {...}; tie %argH, 'Tie::Hash::KeyMask',$mask, more arguments; Yield that the key mask function &$mask translates any key when applied to %argH like .. $k => $mask->($k, more arguments) that is $argH{$k} expands to $argH{$mask->($k, more arguments)} $argH{$k} = $v expands to $argH{$mask->($k, more arguments)} = $vIf e.g. choose key mask sub {uc $_} one can access an element without care of case of the key. In place of sub { } particular items can be used which will be translated into a CODE. The translation is 'lc' => sub { lc $_ } 'uc' => sub { uc $_ } %M => sub { exists $M{$_} ? $M{$_} : $_}A class-method codemap manage this translation. If it is pleased one could override it and add ones own translations.This class inherits from Tie::Hash::Create by which the tied hash can be obtained anonymously as reference with the command 'Tie::Hash::KeyMask'->newHASH (sub {...}, more arguments)which overrides the tie syntax calling tie from body of newHash. Requirements: · Perl


Tie::Hash::KeysMask Related Software