Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 ( #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? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2022-01-28 23:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (74 votes). Check out past polls.

    Notices?