Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by BillKSmith (Prior)
on Nov 18, 2020 at 16:10 UTC ( #11123780=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

It seems that Fletch has provided you with a workaround. If you are interested in a more formal solution, you will find that it is probably system dependent. Start by reading getc and Term::Key.

UPDATE: I found the link to Term::ReadKey in the documentation of getc. It appears to have useful info. Sorry for the error in posting the link.

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

Replies are listed 'Best First'.
Re^2: Using stdin only if there is input on it, but skipping it if there is no data
by mldvx4 (Monk) on Nov 18, 2020 at 16:34 UTC

    Thanks. The link for Term::Key seems dead, but Term::TermKey is present. However, the CPAN page says that it is deprecated. Is there any other option for more formal solutions, besides getc?

      I'm not aware of any deprecation of Term::ReadKey so perhaps that might also be an option for you.


      🦛

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2021-04-15 01:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?