[Chicago-talk] how to recreate keystoke lost in cbreak?

Richard Reina richard at rushlogistics.com
Wed Dec 28 05:24:27 PST 2005


I have a program that attemps to detect user inactivity with the following code.
  
   use Term::Readkey;
         ReadMode('cbreak');
        unless(my $key = ReadkKey(20)) { 
            # no key was pressed. do something
      } else {
          # key was pressed
           ReadMode('normal');
        }
  
  It works as intedended except for one important defect.  The first  keystroke that triggers the else gets lost.  I've tried adding  print $key; after the Readmode('normal') line (in the else) which puts  the output on the screen, but this seems to not have the same affect as  the keystroke acctually being typed when ReadMode is normal.  Does  anyone know how I can recreate that lost keystroke.  Any help  would be greatly appreciated.
  
  Happy New Year.
  
  Richard
  


A people that values its privileges above its principles soon loses both.
 -Dwight D. Eisenhower.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20051228/d90fe687/attachment.html


More information about the Chicago-talk mailing list