home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Input

$

cons


->Input

Reads an event from the input buffer. Returns a list of values, determined by the type of event. A keyboard event will contain the following values, in order:

  • Event type (1 for keyboard)

  • Key state - true if the key is being pressed, false if the key is being released

  • Repeat count - the number of times the key is being held down

  • Virtual keycode of the key

  • Virtual scancode of the key

  • ASCII code of the character (if the key is a character key, 0 otherwise)

  • State of the control keys (SHIFTs, CTRLs, ALTs, etc.)

A mouse event will return the following values, in order:

  • Event type (2 for mouse)

  • X coordinate (column) of the mouse location

  • Y coordinate (row) of the mouse location

  • Button state - the mouse button(s) which are pressed

  • State of the control keys (SHIFTs, CTRLs, ALTs, etc.)

  • Event flags for the type of the mouse event

This method will return undef on error.

Note that the events returned depend on the input mode of the console; for example, mouse events are not intercepted unless ENABLE_MOUSE_INPUT is specified.