I'm one of the monks who went over this with sgifford in the Chatterbox (davido is the other), I'm completing sgiffords question with some of the findings in the chatterbox. We've established the following:
  1. Code works as is, in perl 5.8.7
  2. Code works with perl 5.6.1 provided you replace the $f1 with an actual globale handle, like F1:
    tie *F1, 'TieTest'; print "Read: ",scalar(<F1>);
  3. Replacing the gensym with an instance of IO::Handle doesn't make a difference (that's why the line use IO::Handle is in this code).
  4. Opening $f1 first to a different handle in order to make the handle exist in the glob, doesn't help.

We're all very curious to what is going on, and if there's a way around it apart from upgrading Perl. I personally suspect that there's a problem with autovivification of the filehandle with the tie, but it's just a suspicion.

Any insight from somebody who really knows what is going on, and preferably, a way to make it work on perl 5.6.1, would be appreciated.

Update I've now had a chance to test it on Indigoperl (Activeperl compatible) 5.6.1 on Win32: I can confirm it has the same problem there. It looks like an actual bug in 5.6.x to me.


In reply to Re: TIEHANDLE problem by bart
in thread TIEHANDLE problem by sgifford

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.