Solved

Testing Kbd input

Posted on 1997-03-25
5
231 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now