The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Basset::Container::Hash

Basset::Container::Hash implements a layered hash. The easiest way to explain is with an example:

 my %x = ('a' => 'b');
 
 tie my %y, 'Basset::Container::Hash', \%x;     #<- %x is the parent of 'y'.
 
 print $x{'a'}; #prints b
 print $y{'a'}; #prints b (inherited from x)
 $y{'a'} = 'foo';
 $y{'z'} = 'bar';
 print $x{'a'}; #prints b
 print $y{'a'}; #prints foo (overriden in y)
 print $x{'z'}; #prints undef (not defined in x
 print $y{'z'}; #prints bar (overridden from x)
 delete $y{'a'};
 print $x{'a'}; #prints b
 print $y{'a'}; #prints b (inherited from x)
 $x{'b'} = 'c';
 print $x{'b'}; #prints c
 print $y{'b'}; #prints c (inherited from x)