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

Book HomeJava and XSLTSearch this book

8.196. Term::Cap

Provides low-level functions to extract and use capabilities from a terminal capability (termcap) database. For general information about the use of this database, see the termcap(5) manpage. Provides the following functions.


$terminal = Tgetent Term::Cap { TERM => termtype, OSPEED=>ospeed }

Acts as the constructor for Term::Cap. Extracts the termcap entry for terminal type termtype and returns a reference to a terminal object. The termcap entry itself is $terminal->{TERMCAP}. Calls Carp::croak on failure. Takes the following arguments:

TERM => termtype
Terminal type. Defaults to the value of the environment variable TERM if termtype is false or undefined.

OSPEED => ospeed
The terminal output bit rate, specified as either a POSIX termios/SYSV termio speed or an old BSD-style speed. You can use the POSIX module to get your terminal's output speed (in ospeed here).


$terminal->Tgoto('cm', col, row[, fh])

Produces control string to move the cursor relative to the screen. Doesn't cache output strings, but does % expansion as needed on control string. Takes the following arguments:

Required first argument ("cursor move")

col, row
Column and row to move cursor to

Filehandle that will receive the control string


$terminal->Tpad(string, count, fh)

Specifies padding required to create delay needed by terminal. Takes the following arguments:

The string to pad with

The number of pad characters

The filehandle to pad


$terminal->Tputs('cap', count[, fh])

Produces control string for capabilities other than cursor movement. Does not do % expansion, but does cache output strings if $count = 1. Takes the following arguments:

Capability to produce control string for

Should be 1 unless padding is required (see Tpad); if greater than 1, specifies amount of padding

Filehandle to receive the control string



Checks to see whether the named capabilities, caps, are defined in the terminal's termcap entry. For example:

$terminal->Trequire(qw/ce ku kd/);

Any undefined capabilities are listed, and Carp::croak is called.

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.