I'm writing a Perl program that will have all of its input come from a PS/2 keypad that has no Numlock light on it. Because Numlock can be turned on and off at the pad but there's no way to see, just by looking at the pad, what the status of Numlock is I would like like to have an on-screen indicator for this.
Is there any way with Perl to retrieve the status of Numlock and perhaps even get updates when it is turned on or off? I know I could run setleds every few seconds and parse the output from there, but that doesn't seem like a very clean solution and also wouldn't be able to update the screen right away when the key is pressed.