Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Is it possible at all to flush buffer and commit file write, if UTF-8 encoding is being used??

by ikegami (Patriarch)
on Oct 13, 2023 at 18:51 UTC ( [id://11154945] : note . print w/replies, xml ) Need Help??


in reply to Is it possible at all to flush buffer and commit file write, if UTF-8 encoding is being used??

my $oldfh = select $logf; $| = 1; select($oldfh); *does* flush Perl's buffer.

$logf->autoflush(1); *does* flush Perl's buffer.

$logf->flush(); *does* flush Perl's buffer.

close $logf; *does* flush Perl's buffer.

It doesn't necessary flush the OS's buffers. (You'll need to ask the OS to do that.) But the data will appear in the file to other processes.