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

Pete Krawczyk mongers at bsod.net
Wed Dec 28 10:07:10 PST 2005

Subject: [Chicago-talk] how to recreate keystoke lost in cbreak?
From: Richard Reina <richard at rushlogistics.com>
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
	# $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 

-Pete K
Pete Krawczyk
  mongers at bsod dot net

More information about the Chicago-talk mailing list