Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^2: The print is output later after die

by eyepopslikeamosquito (Bishop)
on Jan 29, 2022 at 02:21 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2023-03-26 03:53 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (63 votes). Check out past polls.