Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Increasing the write buffer

by ikegami (Patriarch)
on Jun 21, 2008 at 17:54 UTC ( [id://693291]=note: print w/replies, xml ) Need Help??


in reply to Re: Increasing the write buffer
in thread Increasing the write buffer

There are three buffering states:

  • unbuffered
  • block buffered: Writes when 4KB* is accumulated.
  • line buffered: Writes when \n is encountered or 4KB* is accumulated.

If a handle is buffered, line buffering is always and only used when the file handle is connected to a terminal.

So, if you're writing to a file, \n won't flush. But if you're writing to STDOUT and it hasn't been redirected, \n will flush if buffering wasn't turned off.

You can turn on buffering using

use IO::Handle qw( ); FH->autoflush(0);

You can turn off buffering using

use IO::Handle qw( ); FH->autoflush(1);

You can flush manually using

use IO::Handle qw( ); FH->flush();

* — Well, I *think* the buffer size is 4KB.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://693291]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-24 10:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found