[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

perl5.8 problem with Term::ReadKey



Hi List

I just upgraded from woody to sid (perl 5.6 to perl 5.8) and noticed one of 
my important scripts not to work anymore. It uses Term::ReadKey to break a 
loop if I type in "x" or "X":

# This is a very reduced form of what I need...
#!/usr/bin/perl -w
use Term::ReadKey;

ReadMode 'cbreak';
 AUSSEN: for ($i=0; $i<= 100; $i++){
     print "$i";
     if (defined ($char = ReadKey(-1)) ) {
	 if ($char  =~ /[xX]/){
	     print "\nInterrupted!\n";
	     last AUSSEN;
	 }
     } else {
	 sleep 1;
     }
 }
print "\nNicht Abgebrochen!\n";
ReadMode 'normal';
# end snippet

This should print out numbers from 1 to 10, and bread and print out 
"Interrupted!" and exit.
This is not the case. Did I miss something? The example on www.perldoc.com 
looks just the same...

thanks
joerg

Ah, here are the packages I have installed:
ii  libperl5.8     5.8.0-14       Shared Perl library.
ii  libterm-readke 2.21-1.3       A perl module for simple terminal control
ii  perl           5.8.0-14       Larry Wall's Practical Extraction and Report
ii  perl-base      5.8.0-14       The Pathologically Eclectic Rubbish Lister.
ii  perl-doc       5.8.0-14       Perl documentation.
ii  perl-modules   5.8.0-14       Core Perl modules.



Reply to: