Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: The print is output later after die

by eyepopslikeamosquito (Archbishop)
on Jan 29, 2022 at 02:21 UTC ( [id://11140946]=note: print w/replies, xml ) Need Help??


in reply to Re: The print is output later after die
in thread The print is output later after die

Nice example! I prefer autoflush because the intent is much clearer than messing with the $| global variable.

As an aside, it's a shame Perl was originally released with so many evil global variables because by the time lexical file handles made it into Perl 5.6 a host of unfortunate idioms were in common use, such as:

select((select(FH), $|=1)[0]);

Of course, such old coding horrors like this can be expressed more clearly nowadays with a lexical file handle (see also):

use IO::Handle; # update: not needed for Perl 5.14+ # ... $fh->autoflush();

For more examples of historic interface design boo-boos, see the Some Examples of Interface Mistakes section at: On Interfaces and APIs

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-26 00:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found