This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Read Perl code on Windows in text mode by default.
authorJan Dubois <jand@activestate.com>
Thu, 17 Mar 2011 00:45:29 +0000 (17:45 -0700)
committerJan Dubois <jand@activestate.com>
Thu, 17 Mar 2011 00:59:44 +0000 (17:59 -0700)
commit270ca148cf26bc57d0c23f0208157e1323cd660b
tree1be645414766ca1743dd24a55874436a60a55d0c
parent6241f69ed4d47a277df162e594581e52c94f541e
Read Perl code on Windows in text mode by default.

We used to read Perl code in binary mode to make life easier for
ByteLoder to include binary data in a source file.  To maintain the
illusion of text mode for the DATA handle the filehandle was
transformed from binary mode to text mode when the parser reached the
__END__ or __DATA__ tokens.

This however never worked correctly, as the positions returned by
tell(DATA) were still based on reading part of the stream in binary
mode.  And even worse, flushing all filehandles before calling
system(), backticks, or fork() would actually reposition the DATA
filehandle incorrectly, so future reads from it returned the wrong
data.

http://rt.perl.org/rt3/Ticket/Display.html?id=28106 contains several
bug reports that are all related to this problem.  The new t/io/data.t
file contains the failing code samples from those bugs.

This patch changes the default build option for Windows to text mode.
ByteLoader will have to deal with this internally, e.g. by rewinding
DATA and switching to binary mode itself.
MANIFEST
pod/perldelta.pod
t/io/data.t [new file with mode: 0644]
win32/Makefile
win32/makefile.mk