Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: $io->autoflush - which perl version?

by Anonymous Monk
on Mar 27, 2016 at 19:53 UTC ( [id://1158900]=note: print w/replies, xml ) Need Help??


in reply to $io->autoflush - which perl version?

AFAIK for $io->autoflush(1); to work you just have to add use IO::Handle; at the top of your code; should work all the way back to at least 5.8. Perl 5.14 and up loads IO::Handle automatically, which is why the "autoflush" method "just works" there.

The command "corelist IO::Handle" says "IO::Handle was first released with perl 5.00307".

The other kind of kludgy but AFAIK backwards-compatible way to set autoflush on a handle is { my $tmp = select($io); $| = 1; select($tmp) }.

And your "if" statement could be written like this: if($] lt "5.008") ...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-19 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found