Tickit::Term - terminal IO handler
Tickit::Term
Provides terminal IO primatives for Tickit. Split into two primary sections:
Tickit
Output
Methods to provide terminal output; writing text, changing pen attributes, moving the cursor, etc.
Input
Event callbacks for keypress events.
As well as the configuration named parameters, takes the following named arguments at construction time:
IO handle for terminal input. Will default to STDIN.
STDIN
IO handle for terminal output. Will default to STDOUT.
STDOUT
The following events are invoked, either using subclass methods or CODE references in parameters:
The terminal window has been resized.
A key was pressed. $type will be text for normal unmodified Unicode, or key for special keys or modified Unicode. $str will be the UTF-8 string for text events, or the textual description of the key as rendered by Term::TermKey for key events. $key will be the underlying Term::TermKey::Key event structure.
$type
text
key
$str
$key
Term::TermKey::Key
The following named parameters may be passed to new or configure:
new
configure
CODE references for event handlers.
Query the current size of the terminal. Will be cached and updated on receipt of SIGWINCH signals.
SIGWINCH
Print the given text to the terminal at the current cursor position
Move the cursor to the given position on the screen. If only one parameter is defined, does not alter the other. Both $line and $col are 0-based.
$line
$col
Move the cursor relative to where it currently is.
Scroll the region of the screen that starts on line $from until (and including) line $to down, $by lines (upwards if negative).
$from
$to
$by
Changes the current pen attributes to those given. Any attribute whose value is given as undef is reset. Any attributes not named are unchanged.
undef
For details of the supported pen attributes, see Tickit::Pen.
Similar to chpen, but completely defines the state of the terminal pen. Any attribute not given will be reset to its default value.
chpen
Erase the entire screen
Clear the current line from the cursor onwards.
Erase $count characters forwards. If $moveend is true, the cursor is moved to the end of the erased region. If false, the cursor will remain where it is.
$count
$moveend
Using $moveend may be more efficient than separate erasech and goto calls on terminals that do not have an erase function, as it will be implemented by printing spaces. This removes the need for two cursor jumps.
erasech
goto
Insert $count blank characters, shifting following text to the right.
Delete the following $count characters, shifting the remaining text to the left. The terminal will fill the empty region with blanks.
Set or clear the DEC Alternate Screen mode
Set or clear the cursor visible mode
Paul Evans <leonerd@leonerd.org.uk>
To install Tickit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tickit
CPAN shell
perl -MCPAN -e shell install Tickit
For more information on module installation, please visit the detailed CPAN module installation guide.