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.

Tgetent

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

Tgoto

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

'cm'
Required first argument ("cursor move")

col, row
Column and row to move cursor to

fh
Filehandle that will receive the control string

Tpad

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

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

string
The string to pad with

count
The number of pad characters

fh
The filehandle to pad

Tputs

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

cap
Capability to produce control string for

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

fh
Filehandle to receive the control string

Trequire

$terminal->Trequire(caps)

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.