http://qs1969.pair.com?node_id=11138501


in reply to Re^4: Test::Harness bug ? ... or author idiocy ?
in thread Test::Harness bug ? ... or author idiocy ?

Your trivial examples are printing to the shell, presumably in a terminal. That is what makes it default to autoflush. Redirect that output and it's a different story. Compare:

$ perl -e 'for(1..10) {print ".\n"; sleep 1}' | sed -e 's/\./#/g'

with

$ perl -e '$|++; for(1..10) {print ".\n"; sleep 1}' | sed -e 's/\./#/g +'

See the excellent Suffering from Buffering (particularly the section Hot and Not Hot) for more on this.

When something else is wrapping the STDOUT, like your test harness for example, then the autoflushing is no longer applied by default. Everything in Perl should still be printed in the right order but I expect that the printf output in the C part is bypassing the higher-level buffer (just a guess - I don't know enough about how Inline::C works to say for sure).


🦛