Solved

Testing Kbd input

Posted on 1997-03-25
5
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl program to obtain a machine's memory usage 6 29
cpan issue 1 70
Add additional column to .csv using Perl. 8 177
octal error in perl program 3 43
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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…

752 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