Tie::UnionHash

Tie::UnionHash package contains union hashes.
Download

Tie::UnionHash Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Zahatski Aliaksandr
  • Publisher web site:
  • http://search.cpan.org/~zag/Tie-UnionHash-0.01/lib/Tie/UnionHash.pm

Tie::UnionHash Tags


Tie::UnionHash Description

Tie::UnionHash package contains union hashes. Tie::UnionHash package contains union hashes. Make changes to the last hash in arguments ( depend on option < freeze_keys >).SYNOPSIS use Tie::UnionHash; tie %uhash, 'Tie::UnionHash', %hash1ro, %hash2rw; tie %hashu, 'Tie::UnionHash', %hash1, %hash2, 'freeze_keys' ; Tie::UnionHash - Merge multiple hashes into a one hash. Make changes only to the last hash in arguments, unless used option freeze_keys.Tie::UnionHash can handle anything that looks like a hash; just give it a reference as one of the additional arguments to tie(). This includes other tied hashes, so you can include DB and DBM files as data sources for a union hash. If given a plain name instead of a reference, it will use as option.UnionHash correctly distinguish deleted keys. my %hash1 = ( 1 => 1, 3 => 3 ); my %hash2 = ( 2 => 2, 3 => 3 ); my %hashu; tie %hashu, 'Tie::UnionHash', %hash1, %hash2; # keys %hashu is $hashu{3} = 4 #change %hash2; delete $hashu{3} #change %hash2 and track deleted keys exist $hashu{3} # false, but exists in read only hashesOption freeze_keys will change mode to readonly keys in hashes, except last hash in arguments. my %hash1 = ( 1 => 1, 3 => 3 ); my %hash2 = ( 2 => 2, 3 => 3 ); my %hashu; tie %hashu, 'Tie::UnionHash', %hash1, %hash2, 'freeze_keys' ; $hashu{3} = 4 #make changes to %hash1 : ( 1 => 1, 3 => 4 ); $hashu{NEW_KEY} = 1 # make changes to %hash2 : #( 2 => 2, 3 => 3, NEW_KEY =>1 );; Requirements: · Perl


Tie::UnionHash Related Software