www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/11/06/06:47:54

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
X-Injected-Via-Gmane: http://gmane.org/
Path: not-for-mail
From: =?ISO-8859-1?Q?Sven_K=F6hler?= <skoehler AT upb DOT de>
Subject: Re: Perl 5.6.1: Problem with CRLF/LF conversions
Date: Wed, 06 Nov 2002 12:52:51 +0100
Lines: 60
Message-ID: <aqave4$b41$1@main.gmane.org>
References: <Pine DOT GSO DOT 4 DOT 30 DOT 0211051354160 DOT 22446-100000 AT spirit DOT dynas DOT se> <1711732771373 DOT 20011106085425 AT familiehaase DOT de>
NNTP-Posting-Host: pd9e588a0.dip.t-dialin.net
Mime-Version: 1.0
X-Trace: main.gmane.org 1036583173 11393 217.229.136.160 (6 Nov 2002 11:46:13 GMT)
X-Complaints-To: usenet AT main DOT gmane DOT org
NNTP-Posting-Date: Wed, 6 Nov 2002 11:46:13 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2b) Gecko/20021016
X-Accept-Language: de, en
In-Reply-To: <Pine.GSO.4.30.0211051354160.22446-100000@spirit.dynas.se>

warum verweißt du ihn auf perl5.8?
ist es nicht wünschenswert, daß perl dateien im text-mode öffnet?
bzw. sie nur genau dann als binär behandelt, wenn man binmode() aufruft?

Gerrit P. Haase wrote:

> Hallo Mikael,
>
> Am Dienstag, 5. November 2002 um 14:41 schriebst du:
>
>
>
> >I'm trying to port a framework of perl scripts to cygwin. I'm running
> >cygwin 1.3.14 on WinXP. The problem is that perl seems to assume binmode
> >whenever I read a file, but text mode when I write to one.
>
>
> >The sample code below shows the problem.
> >If I write a line to a file with a LF-only ending, perl (or cygwin) 
> adds a
> >CR. When I later read the same line from the file the CR isn't removed.
>
>
> >Is there some special option I need to set to make perl always assume 
> text
> >mode unless I explicitly use the binmode command?
>
>
>
> >#!/usr/bin/perl -w
>
>
> >open(F, "> foobar.txt") || die "Cannot create foobar.txt";
> >print F "Line1\n";
> >print F "Line2\n";
> >close F;
>
>
> >open(F, "< foobar.txt") || die "Cannot open foobar.txt";
> >while () {
> >    s/(.)/sprintf("%02x ", ord($1))/ges;
> >    print "$_\n";
> >}
> >close F;
>
>
> >exit 0;
>
>
>
> Please consider to upgrade Perl to version 5.8,
> click the 'Exp' radiobutton in setup.exe to load
> down and install perl-5.8.0
>
> Then you may play with the new PERLIO features,
> please see: perldoc perlio for details.
>
>
> Gerrit




--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019