Term::Terminfo - access the terminfo database
Term::Terminfo
use Term::Terminfo; my $ti = Term::Terminfo->new; printf "This terminal %s do overstrike\n", $ti->getflag('os') ? "can" : "cannot"; printf "Tabs on this terminal are initially every %d columns\n", $ti->getnum('it'); printf "This terminal %s do overstrike\n", $ti->flag_by_varname('over_strike') ? "can" : "cannot"; printf "Tabs on this terminal are initially every %d columns\n", $ti->num_by_varname('init_tabs');
Objects in this class provide access to terminfo database entires.
This database provides information about a terminal, in three separate sets of capabilities. Flag capabilities indicate the presence of a particular ability, feature, or bug simply by their presence. Number capabilities give the size, count or other numeric detail of some feature of the terminal. String capabilities are usually control strings that the terminal will recognise, or send.
Capabilities each have two names; a short name called the capname, and a longer name called the varname. This class provides two sets of methods, one that works on capnames, one that work on varnames.
This module optionally uses unibilium to access the terminfo(5) database, if it is available at compile-time. If not, it will use <term.h> and -lcurses. For more detail, see the "SEE ALSO" section below.
$ti = Term::Terminfo->new( $termtype )
Constructs a new Term::Terminfo object representing the given termtype. If $termtype is not defined, $ENV{TERM} will be used instead. If that variable is empty, vt100 will be used.
$termtype
$ENV{TERM}
vt100
$bool = $ti->getflag( $capname ) $num = $ti->getnum( $capname ) $str = $ti->getstr( $capname )
Returns the value of the flag, number or string capability of the given capname.
$bool = $ti->flag_by_varname( $varname ) $num = $ti->num_by_varname( $varname ) $str = $ti->str_by_varname( $varname )
Returns the value of the flag, number or string capability of the given varname.
@capnames = $ti->flag_capnames @capnames = $ti->num_capnames @capnames = $ti->str_capnames
Return lists of the capnames of the supported flags, numbers, and strings
@varnames = $ti->flag_varnames @varnames = $ti->num_varnames @varnames = $ti->str_varnames
Return lists of the varnames of the supported flags, numbers, and strings
This distribution provides a small accessor interface onto terminfo. It was originally created simply so I can get at the bce capability flag of the current terminal, because screen unlike every other terminal ever, doesn't do this. Grrr.
bce
It probably also wants more accessors for things like tparm and tputs. I may at some point consider them.
tparm
tputs
unibilium - a terminfo parsing library - https://github.com/mauke/unibilium
unibilium
Paul Evans <leonerd@leonerd.org.uk>
To install Term::Terminfo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Term::Terminfo
CPAN shell
perl -MCPAN -e shell install Term::Terminfo
For more information on module installation, please visit the detailed CPAN module installation guide.