Term::Terminfo(3pm)

πŸ“¦
version 0.09 Β· 3 versions
, in opensuse-leap 16.0

hey bestie!! welcome to Term::Terminfo(3pm), fresh from the User Contributed Perl Documentation πŸ’– this is the page where we access the terminfo database, and it’s lowkey iconic. no cap.

🌸 NAME 🌸

Term::Terminfo β€” access the terminfo database. periodt.

✨ SYNOPSIS ✨

okay so here’s the whole vibe in code, bestie:

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');

πŸ’– DESCRIPTION πŸ’–

Objects in this class give you access to terminfo database entries. yes bestie, entries. we’re being normal about it.

This database has all the tea about a terminal, split into three separate sets of capabilities:

  • Flag capabilities β€” they indicate the presence of a particular ability, feature, or bug just by being present.
  • Number capabilities β€” they give the size, count, or other numeric detail of some feature of the terminal.
  • String capabilities β€” 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 set works on capnames, and one set works 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.

πŸŽ€ CONSTRUCTOR πŸŽ€

🌟 new 🌟

$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. slay.

πŸ’… METHODS πŸ’…

✨ getflag / getnum / getstr ✨

$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.

πŸ¦‹ flag_by_varname / num_by_varname / str_by_varname πŸ¦‹

$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.

🌈 flag_capnames / num_capnames / str_capnames 🌈

@capnames = $ti->flag_capnames

@capnames = $ti->num_capnames

@capnames = $ti->str_capnames

Return lists of the capnames of the supported flags, numbers, and strings.

πŸ“ flag_varnames / num_varnames / str_varnames πŸ“

@varnames = $ti->flag_varnames

@varnames = $ti->num_varnames

@varnames = $ti->str_varnames

Return lists of the varnames of the supported flags, numbers, and strings.

🫢 TODO 🫢

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.

It probably also wants more accessors for things like tparm and tputs. I may at some point consider them.

πŸ‘€ SEE ALSO πŸ‘€

πŸ¦‹ AUTHOR πŸ¦‹

Paul Evans <leonerd@leonerd.org.uk>


mwah πŸ’‹ β€” this page is from perl v5.42.0, dated 2025-02-06. byeee bestie 🫢

πŸ“¦ where this page comes from