Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Perl stops reading __DATA__ when meeting SUB character on Windows (history)

by tye (Cardinal)
on Jan 06, 2014 at 00:53 UTC ( #1069436=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl stops reading __DATA__ when meeting SUB character on Windows
in thread Perl stops reading __DATA__ when meeting SUB character on Windows

I've been using Perl on Windows, and ^Z has never interrupted reading, even without binmode.

Perl on MS Windows has a long history of stopping reading at CTRL-Z (yes, even in files). That it predates your history with Perl on MS Windows (or just your memory) doesn't cause that history to no longer exist.

Your program produces 4 for me, whether binmode is commented out or not (v5.12).

I recall MS Windows changing its (default) treatment of CTRL-Z in files. This thread makes it clear that Perl did as well.

Some experiments lead me to believe that Perl has/had separate logic for stopping at CTRL-Z when reading Perl source code (and that binmode doesn't/didn't disable/reset that). I'll leave it to others to find that in the Perl source code and determine when that got removed as well (probably after v5.12 but before ikegami's version, which he doesn't mention).

At least, the DATA that Perl v5.12 opened for me stops at CTRL-Z whether binmode has been called on it or not (even after I control for the buffering problem I had experienced before and described elsewhere in this thread) while a DATA that I open myself reads CTRL-Z just fine, whether binmode is used or not.

- tye        


Comment on Re^2: Perl stops reading __DATA__ when meeting SUB character on Windows (history)
Re^3: Perl stops reading __DATA__ when meeting SUB character on Windows (history)
by Anonymous Monk on Jan 06, 2014 at 02:00 UTC
Reaped: Re^3: Perl stops reading __DATA__ when meeting SUB character on Windows (history)
by NodeReaper (Curate) on Jan 06, 2014 at 11:53 UTC
Re^3: Perl stops reading __DATA__ when meeting SUB character on Windows (history)
by ikegami (Pope) on Jan 06, 2014 at 11:54 UTC

    That it predates your history with Perl on MS Windows (or just your memory) doesn't cause thaat history to no longer exist.

    1. The OP is using binmode. That should never stop at ^Z!

    2. Unless you're saying the OP is using a Perl older than 5.6, I don't see your point. I consider anything older than 5.8 irrelevant unless explicitly mentioned.

    Your program produces 4 for me, whether bindmode is commented out or not (v5.12).

    Then I ask you the same question I asked the OP: Could I see your perl -V output?

    Update: I'm sure I had an old version of Perl that didn't treat ^Z specially, but it doesn't seem to be the case. It does appear to be a new fix, so disregard the request. I couldn't test until now.

      Part of the puzzle might be p5git://commit=9b1f1815, which became part of v5.14.

      The OP is using binmode. That should never stop at ^Z!

      So if Perl hits EOF due to CTRL-Z (while reading source code), then subsequently doing binmode will clear that EOF condition?

      - tye        

        If you're asking if it should, then probably not. I have no idea what it actually does.

        I don't see how that's relevant to this situation or the text you quoted. Perl should not have reached the ^Z while reading the source code. It should have found __DATA__ first.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1069436]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2014-12-28 09:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (180 votes), past polls