Mail Archives: cygwin/2006/05/01/14:10:44
On Sun, 23 Apr 2006, Michael Lemke wrote:
> Dave <kilroyd <at> googlemail.com> writes:
>
> >
> > Have you tried setting the environment variable PERLIO? I'm not a heavy
> > PERL user, but I tend to have
> >
> > PERLIO=crlf
> >
> > if I'm likely to see CRLFs.
>
> Thanks, I tried that. It indeed seems to remove the \r but independent
> of the mount mode of the disk. I googled a bit and found an old thread
> about this where Max Bowsher sums it up in
> http://www.mail-archive.com/cygwin AT cygwin DOT com/ msg22668.html What a
> mess. And no solution it seems. The perl docs say a simple open X,
> file; opens the file in text mode. So I expect the subsequent read (and
> chomp) to treat a \r according to mount mode of the file system.
> PERLIO=crlf changes it for all files. Is it just me or do other people
> also feel this is broken?
>
> Michael
FWIW, you can control this on a file-by-file basis by issuing
binmode(FH,":crlf") after open(FH,filename). See "perldoc -f binmode" for
more details.
Igor
> > > Lemke, Michael SZ/HZA-IOM1 <lemkemch <at> schaeffler.com> writes:
> > >
> > >>If I execute this perl script
> > >>
> > >> de010597> cat x.pl
> > >> #!/usr/bin/perl
> > >> use strict;
> > >>
> > >> open( HO, "<x.txt" );
> > >> while (<HO>) { print "$_"; }
> > >>
> > >>on a text mount with an input file that has CRLF line endings perl
> > >>should treat this as a text file and strip the CR. Only if I use
> > >>binmode HO should I see the CR. But it doesn't:
> > >>
> > >> de010597> ./x.pl | cat -A
> > >>bla^M$
> > >> de010597> cat -A x.txt
> > >>bla^M$
> > >>
> > >>What am I missing here?
> > >>
> > >> de010597> pwd
> > >>/d/jakarta-tomcat/awstats
> > >> de010597> mount
> > >>D:\PROGRA~1\cygwin\bin on /usr/bin type system (binmode)
> > >>D:\PROGRA~1\cygwin\lib on /usr/lib type system (binmode)
> > >>D:\PROGRA~1\cygwin on / type system (binmode)
> > >>c: on /c type system (textmode,noumount)
> > >>d: on /d type system (textmode,noumount)
> > >>f: on /f type system (textmode,noumount)
> > >> de010597> mount -m
> > >>mount -f -s -b "D:/PROGRA~1/cygwin/bin" "/usr/bin"
> > >>mount -f -s -b "D:/PROGRA~1/cygwin/lib" "/usr/lib"
> > >>mount -f -s -b "D:/PROGRA~1/cygwin" "/"
> > >>mount -s -t --change-cygdrive-prefix "/"
> > >> de010597> uname -a
> > >>CYGWIN_NT-5.2 de010597 1.5.18(0.132/4/2) 2005-07-02 20:30 i686 unknown
> > >>unknown Cygwin
> > >> de010597> perl -v
> > >>
> > >>This is perl, v5.8.7 built for cygwin-thread-multi-64int
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
ZZZzz /,`.-'`' -. ;-;;,_ Igor Peshansky, Ph.D. (name changed!)
|,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -