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 X-MimeOLE: Produced By Microsoft Exchange V6.0.4712.0 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Subject: RE: Perl, text files, & \r Date: Sun, 8 Jul 2001 15:23:31 -0700 Message-ID: <0FA38CF91938AC4F8FDC4960E389D763A716A8@red-msg-10.redmond.corp.microsoft.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Perl, text files, & \r thread-index: AcEH+p7oBQ4yAN2cQBGGE93xm1HJogAALIgA From: "Stephan Mueller" To: "Christopher Rath" , "Cygwin Maillist" Cc: "Michael A. Chase" , X-OriginalArrivalTime: 08 Jul 2001 22:23:15.0986 (UTC) FILETIME=[953A3F20:01C107FC] Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id TAA09935 Hmm, doesn't sound like a cygwin related issue anymore. Sounds like what you want to do is call binmode once on each file you open. The cost to you is very small, and the number of scripts that don't want to deal with the line ending differences that are portable because the default is to hide the difference is huge. Note that modern perl is taking steps in the direction of more control over this sort of stuff with the idea of line-disciplines. In this particular case, perl behaves the way the C runtime libraries of many DOS/Windows compilers have been behaving for decades, with some small explicit distinction between text and binary files and support for both. "A file is just a collection of bits" is _a_ definition, it's not _the_ definition. "Translating and obscuring reality" is what an awful lot of software is all about. The idea that various 'real' I/O devices, including files on disk, disks and printers are just a stream of bits is in fact, a simplifying abstraction, and is considered one of the significant innovations of Unix, oh, 30+ years ago. stephan(speaking only for myself, and not representing my employer in any official capacity); -----Original Message----- From: Christopher Rath [mailto:christopher AT rath DOT ca] Sent: Sunday, July 08, 2001 3:09 PM To: Cygwin Maillist Cc: Michael A. Chase; gp AT familiehaase DOT de 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. =========== Christopher Rath == (613) 824-4584 =========== 1371 Major Rd., Orleans, ON, Canada K1E 1H3 =============== mailto:christopher AT rath DOT ca =============== ``Hydrogen is a colourless, odourless gas which, given enough time, turns into people.'' --- Henry Hiebert ================== http://www.rath.ca/ =================== -----Original Message----- From: Michael A. Chase [mailto:mchase AT ix DOT netcom DOT com] Sent: 8 July, 2001 15:20 To: gp AT familiehaase DOT de; Christopher Rath Cc: cygwin AT cygwin DOT com Subject: Re: Perl, text files, & \r ----- Original Message ----- From: "Gerrit P. Haase" To: "Christopher Rath" Cc: Sent: Sunday, July 08, 2001 06:40 Subject: RE: Perl, text files, & \r > Christopher Rath schrieb am 2001-07-07, 23:13: > > > solution: use of the 'binmode' command. > > Would it help to set the environment settings CYGWIN=binmode ? > > [...] > > I think this should be in the Cygwin FAQ. Why this works can be > > found on > > pp. 53-55 and 147 of "Programming Perl 2nd Ed." > > Is it a cygwin issue or more a perl one? > You can choice at setup time between 'unix(==binmode)' and > 'windows(==textmode)' mode. You could mount with '-b' for binmode. > It should work as it does on unixlike systems if you setup > with binmode as default. It's really a portable programming issue which affects Perl, Python, C, ... If you know a file needs to be read or written without text modification, it should be opened in binary mode or set to binary mode as early as possible. The mount and CYGWIN binmode and textmode options are workarounds for programs that didn't take that into account when they were originally written. -- 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. -- 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/ -- 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/