in reply to tying tied hash scalars

This one seems to work (it hashes a reference):

use strict; use Tie::IxHash; use Tie::Scalar::Timeout; my %hash; tie %hash, "Tie::IxHash"; tie ${$hash{TIMED}}, "Tie::Scalar::Timeout", EXPIRES => '+2s'; print "hash tie = ", tied(%hash), "\n"; print "TIMED tie = ", tied(${$hash{TIMED}}), "\n";

Output:

hash tie = Tie::IxHash=ARRAY(0x80f8240) TIMED tie = Tie::Scalar::Timeout=HASH(0x81038e4)

Replies are listed 'Best First'.
Re: Re: tying tied hash scalars
by steves (Curate) on Dec 02, 2002 at 19:18 UTC
    Yes, that works for me too. Problem is I now have to change all existing hash accesses to use the reference. Part of what I'm trying to do is alter the underlying behavior of a widely used hash, where the hash elements are already assumed to be tied themselves. I don't really want to change all that code. The idea was to tie the hash where it's created and leave the rest of the code alone.