Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <000001c10889$131ffdd0$6464648a@ca.boeing.com> From: "Michael A. Chase" To: "Christopher Rath" , "Cygwin Maillist" References: Subject: Re: Perl, text files, & \r Date: Sun, 8 Jul 2001 19:26:15 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Perl is the Pathologically Eclectic Rubbish Lister after all (but don't tell anyone I said that). The vast majority of scripts are intended to process text which makes it very handy that the line ending variations can be abstracted. The poorly thought out part was MSDOS bringing forward the CP/M text file format with "\0x0D\0x0A" to end lines and "\0x1A" to terminate the file. Since then, every MSDOS C I/O library has had to convert "\0x0D\0x0A" to "\n" for text files to make line endings look the same in MSDOS or UNIX. If you want absolute control of your file I/O, you can and should call binmode(). This is not accommodating anything, it is complying with the documented behavior of the language. The Cygwin environment _does_ attempt to help programs compiled in it deal gracefully with MSDOS line endings. That is what the '-b' and '-t' switches are for in the mount command. If you mount a directory tree with the '-b' option, you get exactly the behavior you want. With the '-t' option, you get the behavior you seem to be so steamed about, but that can be overridden with binmode() as I stated above. What does Microsoft have to do with the Perl build in Cygwin? If you consider Microsoft's behavior parental, I'm glad I'm not in that family. -- Mac :}) ** I normally forward private questions to the appropriate mail list. ** Give a hobbit a fish and he eats fish for a day. Give a hobbit a ring and he eats fish for an age. ----- Original Message ----- From: "Christopher Rath" To: "Cygwin Maillist" Cc: "Michael A. Chase" ; Sent: Sunday, July 08, 2001 15:08 Subject: RE: Perl, text files, & \r > > I personally resent the fact that perl tries to hide from me the fact that > MS-DOS text files use and not just as their end of line > sequence. The choice to translate and obscure reality as a default is > something I consider rather poorly thought out. A file is just a file; it's > a collection of bits. The fact that it contains structure should not be > imposed by the interpreter; rather it should be handled by the programmer. > > The cygwin tools themselves (e.g., makeindex) don't attempt to deal with the > issue, so why does perl? The default behaviour should be NO > translation (i.e., binmode on). If I want the computer to do something for > me then I'll make the request. Perl's present behaviour is exactly the type > of parental attitude Microsoft so commonly displays and it is rather > unbecoming when it appears in perl. > > My perl script deals properly with the content of the files it encounters; > however, when I wrote it I never accommodated perl's file I/O behaving in > such a fascist manner. > -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/