Newsgroups: comp.lang.perl Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!usenet.ins.cwru.edu!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) Subject: Re: (f)flush? Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) Organization: North Coast Public Access *NIX, Cleveland, OH Date: Thu, 2 Aug 90 22:54:10 GMT Message-ID: <1990Aug2.225410.2587@NCoast.ORG> Followup-To: comp.lang.perl References: <7193@star.cs.vu.nl> <8936@jpl-devvax.JPL.NASA.GOV> As quoted from <8936@jpl-devvax.JPL.NASA.GOV> by lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall): +--------------- | In article <7193@star.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: | : Is (f)flush such a bad idea that it isn't to be included in `libperl.a'? | : Trivial to write, of course, but shouldn't it be STDPerl? (I don't want | : immediate writes all the time, you know...) | | Good grief. +--------------- Larry, let me correct this suggestion, invert it, and justify it: I would like to have a per-filehandle immediate-flush flag to replace the current $| variable. There are times when I want buffered output on one filehandle but not the others. Additionally, I'd like a "setbuf" function, again per-filehandle. Reason? I sat down and wrote a cpio in Perl in response to the tar in Perl that was posted a few weeks ago, including a library to do tape buffering... and then remembered that Perl uses stdio and its default buffers. I can turn off buffering with $|, but it then goes character at a time instead of print statement at a time, no? And I don't necessarily want to unbuffer stdout while I'm doing this, and setting $| every time I want to do tape I/O is a major pain. Worse is to have a setbuf and have it apply to all filehandles via $|; the standard tape block size on our machine is 512K bytes.... This buffering problem is the reason I haven't tried to post my cpio library; as is, it has a lot of excess baggage via the nonfunctional tape-buffering routines, and it won't write tapes with compatible block sizes. Worse, the cpio-reading part will break on machines with stupid tape drivers which deal with reading a small chunk of a large block (i.e. stdio-buffered read of a 20-blocked cpio tape) by returning the requested amount of data and discarding the rest of the block. And yes, there are machines which do that! Mercifully, I've forgotten which one it was, but it screwed me up for a while back when I was free-lance consulting. ++Brandon -- Me: Brandon S. Allbery VHF: KB8JRR on 224.50 (Lake County, OH) Internet: allbery@NCoast.ORG Delphi: ALLBERY uunet!usenet.ins.cwru.edu!ncoast!allbery America OnLine: KB8JRR