http://qs321.pair.com?node_id=893147


in reply to Temp file handles refcount bug?

I get the error on 5.12.2 and 5.12.3. Didn't checking blead. The scalar in question is this one

$fh = IV(0x933914c) at 0x9339150 REFCNT = 1 FLAGS = (PADMY,ROK) RV = 0x938abe8 SV = PVGV(0x9361de8) at 0x938abe8 <-------- REFCNT = 3 FLAGS = () NAME = "$fh" NAMELEN = 3 GvSTASH = 0x924ce18 "File::Temp" GP = 0x923d880 SV = 0x0 REFCNT = 1 IO = 0x922ae48 FORM = 0x0 AV = 0x0 HV = 0x0 CV = 0x0 CVGEN = 0x0 LINE = 513 FILE = "/home/eric/usr/perlbrew/perls/perl-5.12.2/lib/5.12.2/Fil +e/Temp.pm" FLAGS = 0x0 EGV = 0x938abe8 "$fh"

Destroying the tied handle before global destruction appears to avoid the problem.

{ my $fhWrapper = Symbol::gensym; tie(local *$fhWrapper, 'MyWrapper', $fhWrapper, $fh); ... }

Replies are listed 'Best First'.
Re^2: Temp file handles refcount bug?
by ELISHEVA (Prior) on Mar 14, 2011 at 20:55 UTC

    That doesn't work on my machine, but deselecting the tied handle does silence the complaint, e.g. making the last line select STDOUT or some such.