develooper Front page | perl.perl5.porters | Postings from May 2013

[perl #26988] EOF character (0x1A) returned as data when reading text files

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
May 27, 2013 23:09
Subject:
[perl #26988] EOF character (0x1A) returned as data when reading text files
Message ID:
rt-3.6.HEAD-2650-1369696149-1888.26988-15-0@perl.org
On Mon May 27 10:21:08 2013, ikegami@adaelis.com wrote:
> On Mon, May 27, 2013 at 8:55 AM, James E Keenan via RT <
> perlbug-followup@perl.org> wrote:
> 
> > Is there someone with up-to-date Perl and Windows who could assess the
> > issues discussed in this older ticket?
> >
> 
> Perl still doesn't treat ^Z specially as of 5.16.2 (and no reason to
> believe it's any different in 5.18.0).
> 
>     >perl -e"print qq{abc\n\cZ\ndef\n}" >file
> 
>     >type file
>     abc
> 
>     >perl -pe1 file
>     abc
>     →
>     def
> 
>     >perl -pe1 <file
>     abc
>     →
>     def
> 
> Note that using Ctrl-Z to close STDIN (as you would use Ctrl-D in unix)
> works fine.
> 
>     >perl -pe1
>     abc
>     abc
>     ^Z
> 
> I don't think this is a "feature" we need to implement. While I
encountered
> a couple of text files with a trailing ^Z back in the days of DOS 3, I've
> never encountered such a file since. Windows text editors (e.g.
notepad) do
> not treat ^Z specially. Even C<type> (used above) only obeys it when
> writing to a terminal.
> 
>     >type file | perl -pe1
>     abc
>     →
>     def
> 
> I don't see any reason to implement it other than "some other
libraries do"
> (including C's stdio).
> 
> - Eric

I'll take that as a YAGNI ... and I'll take the ticket for the purpose
of closing it in seven days unless we get good arguments to the contrary.

Thanks for looking into this.

Jim Keenan



---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=26988

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About