Solved

Testing Kbd input

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

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…
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

777 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