Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Using stdin only if there is input on it, but skipping it if there is no data

by salva (Canon)
on Nov 18, 2020 at 08:39 UTC ( [id://11123774]=note: print w/replies, xml ) Need Help??


in reply to Using stdin only if there is input on it, but skipping it if there is no data

You can use select (see perlfunc) to check whether data is available from a file descriptor.

Though, that could incur in a race condition, for instance, when the data is generated by another process running in parallel. So, you should probably set a safe waiting time (the last select argument).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-23 06:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found