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

Steven Lembark lembark at wrkhors.com
Wed Dec 28 10:03:22 PST 2005



-- Richard Reina <richard at rushlogistics.com>

> 
> I have a program that attemps to detect user inactivity with the
> following code.
>  
>  use Term::Readkey;
>       ReadMode('cbreak');
>      unless(my $key = ReadkKey(20)) { 


Push the scope of $key out of the if-block into the main
loop:

    my $key = '';

    unless( $key = ReadKey(...) )
    {
        ...
    }
    else
    {
        ...
    }

    # $key is still available here for
    # processing.


-- 
Steven Lembark                                       85-09 90th Street
Workhorse Computing                                Woodhaven, NY 11421
lembark at wrkhors.com                                     1 888 359 3508


More information about the Chicago-talk mailing list