[comp.lang.perl] eval problem

me@anywhere.EBay.Sun.COM (Wayne Thompson - IR Workstation Support SE) (02/28/91)

I'm trying to write a hyperltext (TM) engine in curseperl4.0b. A keypress
references a keymap which looks something like this:

$keymap[ord(' ')] = 'PageDown';
$keymap[ord('J')] = 'ScrollUp';
...

The eval routine looks like this:

eval ("&$keymap[$ch]") || &bell;

and each sub returns 1.

sub ScrollUp {
    $line = &min ($line + int ($lines1 / 2), $#lines - $lines2);
    $curs_index = $curs_byline[$line]
        if $curs_lines[$curs_index] < $line;
    1;
}

The problem is that the eval seems to happen sporadically. It appears not
to call the subroutine and return undef on occasion with a valid keypress.
I haven't been able to discern a pattern yet. Any thoughts?

Wayne