May 26, 2018

Tie::RefHash subclass with weakened references in the keys

The TieRefHash module can be used to access hashes by reference. This is useful when you index by object, for example.

The problem with TieRefHash, and cross indexing, is that sometimes the index should not contain strong references to the objecs. TieRefHash’s internal structures contain strong references to the key, and provide no convenient means to make those references weak.

This subclass of TieRefHash has weak keys, instead of strong ones. The values are left unaltered, and you’ll have to make sure there are no strong references there yourself.

WWW http//