David M. Karr wrote:
>If my default text file type is "DOS", should the cygwin-built Perl
>have the INPUT_RECORD_SEPARATOR variable ($/) be set to "\r\n"? It
>appears to be set to "\n".
If a file with CRLF endings is opened in text mode, the CR should be
automatically stripped by Cygwin before Perl ever sees the line.
The INPUT_RECORD_SEPARATOR should be "\n".
However, now that I'm checking this, it looks like there is a bug
somewhere. If I create a test file x.txt with CRLF endings on a
text mount and create a x.pl script with:
open(STDIN, 'x.txt'); print while(<STDIN>);
If I run 'perl x.pl | od -c' I see only \n as I expected.
However, if this is my script:
open(FH, 'x.txt'); print while(<FH>);
Then, I see \r \n. The only difference is the filehandle.
A strace shows in both cases that the file is being opened in text mode:
fhandler_base::open: filemode set to text
However, in the second case something is triggering a reassessment:
_cygwin_istext_for_stdio: _cygwin_istext_for_stdio (3)
_cygwin_istext_for_stdio: _cifs: get_*_binary
setmode_helper: setmode: file was cle now raw
setmode: setmode (3, binary) returns text
_cygwin_istext_for_stdio: _cygwin_istext_for_stdio (3)
_cygwin_istext_for_stdio: _cygwin_istext_for_stdio says yes
setmode_helper: setmode: file was raw now cle
setmode: setmode (3, text) returns binary
Very odd. I'll try to track this down.
Eric Fifer
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple