Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Timed STDIN input via threads on Win32

by kschwab (Vicar)
on Nov 19, 2013 at 02:38 UTC ( [id://1063245]=note: print w/replies, xml ) Need Help??


in reply to Timed STDIN input via threads on Win32

See the advice in the second reply in this question.
  • Comment on Re: Timed STDIN input via threads on Win32

Replies are listed 'Best First'.
Re^2: Timed STDIN input via threads on Win32
by markperlb0y (Initiate) on Nov 19, 2013 at 02:55 UTC

    That was exactly what I did to solve the thread-safe problem. Inside the read_excel I have that require Win32::OLE line. My problem is that when the timeout expires and I am calling the read_excel sub by creating a thread, then STDIN seems to hang and I have to press enter. If I will call the sub directly, the script continues, however, the problem now becomes the thread-Win32::OLE incompatibility, making the program crash.

      Perhaps you could try Term::Readkey instead? It has built-in support for timeouts. It reportedly works in Win32, and would let you trigger off of a single keystroke, versus the user having to press enter.

        Tried that as well. Unfortunately, it only accepts one character input via ReadKey($timeout). ReadLine does not support > 0 (or non-blocking). The input I'm trying to get from the user can be one or more. I numbered the selection and the user can input as much numbers as there are in the selection and proceed based on his/her selection. I badly need to make this timed STDIN work because the script will be used manually as well as run as a cron/scheduled task..

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-25 20:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found