Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Flushing the print buffers.

by almut (Canon)
on Feb 22, 2008 at 00:22 UTC ( #669432=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Flushing the print buffers.
in thread Flushing the print buffers.

Good question.  With older Perls (pre-5.8) you could do

use IO::Handle '_IOFBF'; my $buf; # set fully buffered, with a buffer size of 1024 bytes STDOUT->setvbuf($buf, _IOFBF, 1024);

but these days, setvbuf/setbuf are no longer available unless perl is compiled to explicitly not use perlio.

I'd like to know myself whether there is a substitute for setvbuf (without writing your own XS), as on rare occasions there might be valid uses for being able to control buffering mode or buffer size with Perl. (The function doesn't seem to be POSIX, so use POSIX; wouldn't help, AFAIK...)


Comment on Re^3: Flushing the print buffers.
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2014-09-24 00:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (243 votes), past polls