perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Landrum <rland...@aol.net>
Subject Re: Getting user input during apache startup
Date Wed, 02 May 2007 21:16:59 GMT
Krist van Besien wrote:
> The code works insofar that it waits 5 seconds and than proceeds with
> the default I set, but it completely ignores any keypresses I make.
> It is as if STDIN is not available at the time this code runs.
> If I replace the ReadKey(5) with a ReadKey(5,STDIN) I get a syntax error.
> 

I suspect that apache may be closing STDIN before it reads the config. 
Maybe.

You could try:

close(STDIN);  # just in case
open(STDIN,"/dev/tty");
ReadMode('cbreak');
print "Press a key\n";
while (1) {
   $key = ReadKey(-1);
   if($key) {
     print "got $key\n";
     last;
   }
}
ReadMode('restore');

Rob

Mime
View raw message