Let's feed the code to the deparser and find out what Perl sees..
$ perl -MO=Deparse -wl -MFatal=open -e 'open A, "date|"; print scalar +<A>' Name "main::A" used only once: possible typo at -e line 1. # .. # lots of imported stuff from Fatal # .. &open('A', 'date|'); print scalar <A>; -e syntax OK

As you can see the A in the open call has become a string. I guess the builtin's prototype cannot be exactly duplicated by Fatal, leading to the filehandle being passed it by symbolic reference rather than globname. Of course perl can't know that that string is a symref to the handle at compile time.

The simplest fix is also a good habit: use lexical variables to hold your filehandles.

$ perl -wl -MFatal=open -e 'open my $pipe, "date|"; print scalar <$pip +e>' Tue Mar 25 02:37:32 CET 2003
This also makes Perl automatically clean up filehandles that go out of scope behind you, and you don't have to be careful not to step on anyone's toes with the chosen filehandle name either.

Makeshifts last the longest.


In reply to Re: Fatal + <FILE> = only once warning (deparsed) by Aristotle
in thread Fatal + <FILE> = only once warning by bsb

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.