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

Richard Reina richard at rushlogistics.com
Wed Dec 28 13:21:59 PST 2005


Pete and Steve,
  
  Thank you for the very instructive responses.  I appreciate it.
  
  Have a Happy New Year.
  
  Richard

Pete Krawczyk <mongers at bsod.net> wrote:  Subject: [Chicago-talk] how to recreate keystoke lost in cbreak?
From: Richard Reina 
Date: Wed, 28 Dec 2005 05:24:27 -0800 (PST)

}It works as intedended except for one important defect.  The first
}keystroke that triggers the else gets lost.

First of all, please send code that compiles and runs to the list when 
you're having problems.  The module is Term::ReadKey, not Term::Readkey, 
and it implements a ReadKey function, not ReadkKey.

That said, your problem is in your control structure.

  unless (my $a = sub()) {
 # $a is in scope here
 do_stuff();
 # $a falls out of scope here
  } else {
        # $a is not in scope here
  }

So really, your code has two options:  Move the 'my $key' above the 
unless statement, or make it an if statement and reverse your blocks of 
code.

-Pete K
-- 
Pete Krawczyk
  mongers at bsod dot net

_______________________________________________
Chicago-talk mailing list
Chicago-talk at pm.org
http://mail.pm.org/mailman/listinfo/chicago-talk




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/37310b47/attachment.html


More information about the Chicago-talk mailing list