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); ... }

In reply to Re: Temp file handles refcount bug? by ikegami
in thread Temp file handles refcount bug? by ELISHEVA

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.