Connecting Tech Pros Worldwide Help | Site Map

How to determine if a key is pressed when tell user to hit any key to continue?

Member
 
Join Date: Sep 2006
Posts: 68
#1: Jul 29 '09
I'm trying to figure out how to read if a key was pressed by the user. For example, a line from a file is displayed and the user is prompted to hit any key to see the next line in the file. I've tried getc(STDIN) with no luck. Maybe I didn't do it right; I don't know. Any suggestions on how I can do this?
Member
 
Join Date: Jun 2009
Posts: 54
#2: Jul 29 '09

re: How to determine if a key is pressed when tell user to hit any key to continue?


Term::ReadKey
http://search.cpan.org/~jstowe/TermR....30/ReadKey.pm
Member
 
Join Date: Sep 2006
Posts: 68
#3: Jul 29 '09

re: How to determine if a key is pressed when tell user to hit any key to continue?


Quote:

Originally Posted by RonB View Post

Term::ReadKey
http://search.cpan.org/~jstowe/TermR....30/ReadKey.pm

I tried using that, too, but now I realize you probably have to insert use CGI qw/:standard/; to make it work, correct?
Member
 
Join Date: Sep 2006
Posts: 68
#4: Jul 29 '09

re: How to determine if a key is pressed when tell user to hit any key to continue?


Quote:

Originally Posted by JWest46088 View Post

I tried using that, too, but now I realize you probably have to insert use CGI qw/:standard/; to make it work, correct?

I'm still getting an internal server error from ReadKey, and I did give the program permissions. Any idea why?
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#5: Jul 29 '09

re: How to determine if a key is pressed when tell user to hit any key to continue?


Maybe you missed this or did not understand:

Term::ReadKey - A perl module for simple terminal control


Term::ReadKey is not for CGI scripts. CGI script don't operate like local programs, you can't use the "hit any key to continue" philosophy. You have to use the "click this button to continue" where when the button is clicked on it sends data back to the CGI script and does whatever it needs to do.
Member
 
Join Date: Sep 2006
Posts: 68
#6: Jul 29 '09

re: How to determine if a key is pressed when tell user to hit any key to continue?


Oh okay. That's probably why getc didn't work either, huh?
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#7: Jul 29 '09

re: How to determine if a key is pressed when tell user to hit any key to continue?


Quote:

Originally Posted by JWest46088 View Post

Oh okay. That's probably why getc didn't work either, huh?

Thats right
Reply