Open p5pRT opened 21 years ago
sysread() does not change CR-LF to "\n". It does not appear to matter how the file is opened. e.g. sysopen(F\, $filename\, O_RDONLY|O_TEXT) does not help open F\, "\<:crlf"\, $filename also does not help
Function readline() works properly.
This behavior is different from earlier versions of Perl. Among other things\, it means that Net::FTP adds an extra CR when sending in ASCII mode from Windows\, as an anonymous user complained at http://perlmonks.org/index.pl?node_id=240189
The same problem exists with syswrite(). In previous versions of Perl it translated "\n" to "\015\012". In this version it does not.
On Wed\, Mar 05\, 2003 at 10:36:50PM -0000\, Ken Hirsch wrote:
sysread() does not change CR-LF to "\n". It does not appear to matter how the file is opened. e.g. sysopen(F\, $filename\, O_RDONLY|O_TEXT) does not help
Does it still not help if you say just sysopen F\, $filename\, 0x4000; or add use Fcntl qw(:DEFAULT); at the beginning of the script ?
(I don't have a Windows system to check\, but Fcntl does _not_ seem to export O_* constants by default)
open F\, "\<​:crlf"\, $filename also does not help
Function readline() works properly.
I think i/o layers affect only read\, readline\, etc not sysread.
Regards
Adi
On Wed\, Mar 05\, 2003 at 10:36:50PM -0000\, Ken Hirsch wrote:
sysread() does not change CR-LF to "\n". It does not appear to matter how the file is opened. e.g. sysopen(F\, $filename\, O_RDONLY|O_TEXT) does not help
Does it still not help if you say just sysopen F\, $filename\, 0x4000; or add use Fcntl qw(:DEFAULT); at the beginning of the script ?
My test already explictly imported O_TEXT and checked the value: use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC O_TEXT); print "O_TEXT = "\, O_TEXT\, "\n"; and O_TEXT was 16384.
[...]
I think i/o layers affect only read\, readline\, etc not sysread.
In previous versions of Perl\, binmode() definitely did affect sysread. The documentation for binmode in perlfunc (last paragraph) says that it does.
Do we still want to change this 18 years later? I don't think we should.
binmode still mentions it affects sysread and syswrite, but it's unclear what it means by that. Certainly its main effect now is to cause sysread/syswrite to die if you set an encoding layer. These functions already bypass buffered I/O.
Migrated from rt.perl.org#21473 (status was 'open')
Searchable as RT21473$