Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^5: Test::Harness bug ? ... or author idiocy ?

by hippo (Bishop)
on Nov 06, 2021 at 13:53 UTC ( #11138501=note: print w/replies, xml ) Need Help??


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).


🦛

Replies are listed 'Best First'.
Re^6: Test::Harness bug ? ... or author idiocy ?
by syphilis (Archbishop) on Nov 06, 2021 at 23:25 UTC
    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</>

    Yeah ... that (and other points you make) seems reasonable.
    Thanks.

    I think it has now been shown to be a case of "author idiocy". (Not surprising, really.)

    Cheers,
    Rob

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2022-05-25 02:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (84 votes). Check out past polls.

    Notices?