Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

perl6/rakudo: Does perl6 enable "autoflush" by default?

#!perl6
use v6;

my $message = "\nHello!\n\nSleep\nTest\n\n";

my @a = $message.split( '' );

for @a {
    sleep 0.3; 
    .print;
}

Does perl6 enable "autoflush" by default. With perl5 without enabling "outflush" I don't get this behavior.

like image 727
sid_com Avatar asked Feb 20 '11 08:02

sid_com


2 Answers

Rakudo enables autoflush by default; the specification is silent about the default.

like image 116
moritz Avatar answered Sep 30 '22 11:09

moritz


Quoting from the docs regarding auto flush:

‘No global alternative available. TTY handles are unbuffered by default, for others, set out-buffer to zero or use :!out-buffer with open on a specific IO::Handle.’

So any printing to stdout is unbuffered and I guess would behave similar to auto flushed stdout of perl5.

Other handles depend on the out-buffer size set.

like image 39
drclaw Avatar answered Sep 30 '22 12:09

drclaw