http://www.perlmonks.org?node_id=510468


in reply to Re: tie() weirdness
in thread tie() weirdness

I guess one solution would be to use a temporary mortal instead of the targ

i just tried that. It doesn't work, because the mortals get freed on the return from the FETCH routine. I should have realised that would happen.

Ouch! I wonder how it can be fixed then?

Update: for completeness I should point out that, although it is indeed true that mortals get freed on return from the FETCH routine, that isn't the (only) reason this doesn't fix the problem. A correct (I hope!) diagnosis and patch can be found in the node below.