APM: changing buffer size to a writable fh
ascii at ev1.net
Thu May 29 14:28:41 CDT 2003
select <F>; $| = 1;
or maybe $^M has something about buffering from perldoc perlvar
On Thursday 29 May 2003 02:01 pm, Ian Ragsdale wrote:
> If it was my script, I'd keep it simple and skip all this buffering stuff.
> I'd just write the data to a different file, and when it is completed, just
> rename the new file to the old file, which is an atomic operation. That
> way, you don't have to worry about losing the old data.
> On 5/29/03 2:00 PM, "jeremy" <jeremyb at univista.com> wrote:
> > I had the same feeling... The file is a web document that gets
> > regenerated every n seconds by the script. I want to make sure that the
> > current file doesn't get over written by the script writing only
> > portions of the new data to the file when the buffer is filled...
> > Basically, I can't have a partial file available on the apache server.
> > Either the old one or the complete new one must be there.
> > I'm not sure how much data it would take to cause this. Indeed, this
> > may not even be an issue if the buffer is large enough.
> > thanks,
> > J
> > On Thu, 2003-05-29 at 13:34, Dennis Moore wrote:
> >> On Thu, May 29, 2003 at 12:29:48PM -0500, jeremy wrote:
> >>> Hey all,
> >>> I have a need to change the buffer used when writing to a file
> >>> handle. The handle to to a flat file. The script dumps data to it.
> >>> ..no big woop.
> >>> More specifically, I need to make sure that none of the data gets
> >>> written to the file until the handle is closed OR until the there is
> >>> no more data regardless of how much data gets kept in memory. I seem
> >>> to remember doing this a while back but I don't remember how. Can
> >>> someone point me in the right direction?
> >> i have a feeling you're asking the wrong question. what is the purpose
> >> of this behavior? how would your program know there is no more data?
> >> you could just store your data in a variable and print when you're
> >> ready. you could also tie the filehandle. you might also take a look
> >> at
> >> Output::Buffer. it looks like that one uses Tie::Filehandle::Buffer so
> >> you'd be using tie in the end that way.
> >> HTH
> > _______________________________________________
> > Austin mailing list
> > Austin at mail.pm.org
> > http://mail.pm.org/mailman/listinfo/austin
> Austin mailing list
> Austin at mail.pm.org
More information about the Austin