Solved

Testing Kbd input

Posted on 1997-03-25
5
262 Views
Last Modified: 2012-06-22
Is it possible in Perl to test for keyboard input while
processing (reading from) a file? I'd like to get a status
report by hitting a key during lengthy processing. I'm using
perl 5.0001 for WindowsNT and I believe 'fork' is not
implemented. Even if I could use fork, how can I get a
status report and hence some kind of value from a block of processing to follow, i.e. a variable not yet initialized?
0
Comment
Question by:caplain032497
  • 3
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
wormzer earned 100 total points
ID: 1203617
This can be done with fork.  Add this before your code that "does a whole bunch of processing"

   if (fork) {
      while (<>) {
         print "GOT ENTER\n"
      }
   }

   <code that does a whole bunch of processing>

With this, you'll fork off another process that just sits waiting for a return and then prints out "GOT ENTER".  There's a whole bunch more stuff you can do from here...  stopping the forked proces...  things like that
   
0
 

Author Comment

by:caplain032497
ID: 1203618
Edited text of question
0
 

Author Comment

by:caplain032497
ID: 1203619
Edited text of question
0
 

Author Comment

by:caplain032497
ID: 1203620
I've appended the question.
0
 
LVL 1

Expert Comment

by:wormzer
ID: 1203621
You're right...  Just fail my answer cus that's all I can think of. Sorry.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question