{
    "content": [
        {
            "type": "text",
            "text": "# Term::Cap (info)\n\n## NAME\n\nTerm::Cap - Perl termcap interface\n\n## SYNOPSIS\n\nrequire Term::Cap;\n$terminal = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };\n$terminal->Trequire(qw/ce ku kd/);\n$terminal->Tgoto('cm', $col, $row, $FH);\n$terminal->Tputs('dl', $count, $FH);\n$terminal->Tpad($string, $count, $FH);\n\n## DESCRIPTION\n\nThese are low-level functions to extract and use capabilities from a\nterminal capability (termcap) database.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **EXAMPLES**\n- **COPYRIGHT AND LICENSE**\n- **AUTHOR**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Term::Cap",
        "section": "",
        "mode": "info",
        "summary": "Term::Cap - Perl termcap interface",
        "synopsis": "require Term::Cap;\n$terminal = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };\n$terminal->Trequire(qw/ce ku kd/);\n$terminal->Tgoto('cm', $col, $row, $FH);\n$terminal->Tputs('dl', $count, $FH);\n$terminal->Tpad($string, $count, $FH);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "use Term::Cap;",
            "# Get terminal output speed",
            "require POSIX;",
            "my $termios = new POSIX::Termios;",
            "$termios->getattr;",
            "my $ospeed = $termios->getospeed;",
            "# Old-style ioctl code to get ospeed:",
            "#     require 'ioctl.pl';",
            "#     ioctl(TTY,$TIOCGETP,$sgtty);",
            "#     ($ispeed,$ospeed) = unpack('cc',$sgtty);",
            "# allocate and initialize a terminal structure",
            "$terminal = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };",
            "# require certain capabilities to be available",
            "$terminal->Trequire(qw/ce ku kd/);",
            "# Output Routines, if $FH is undefined these just return the string",
            "# Tgoto does the % expansion stuff with the given args",
            "$terminal->Tgoto('cm', $col, $row, $FH);",
            "# Tputs doesn't do any % expansion.",
            "$terminal->Tputs('dl', $count = 1, $FH);"
        ],
        "see_also": [
            {
                "name": "termcap",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/termcap/5/json"
            },
            {
                "name": "Cap",
                "section": "3perl",
                "url": "https://www.chedong.com/phpMan.php/man/Cap/3perl/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 145,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Term::Cap - Perl termcap interface\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "require Term::Cap;\n$terminal = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };\n$terminal->Trequire(qw/ce ku kd/);\n$terminal->Tgoto('cm', $col, $row, $FH);\n$terminal->Tputs('dl', $count, $FH);\n$terminal->Tpad($string, $count, $FH);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "These are low-level functions to extract and use capabilities from a\nterminal capability (termcap) database.\n\nMore information on the terminal capabilities will be found in the\ntermcap manpage on most Unix-like systems.\n\nMETHODS\nThe output strings for Tputs are cached for counts of 1 for\nperformance.  Tgoto and Tpad do not cache.  \"$self->{xx}\" is the raw\ntermcap data and \"$self->{xx}\" is the cached version.\n\nprint $terminal->Tpad($self->{xx}, 1);\n\nTgoto, Tputs, and Tpad return the string and will also output the\nstring to $FH if specified.\n\nTgetent\nReturns a blessed object reference which the user can then use to\nsend the control strings to the terminal using Tputs and Tgoto.\n\nThe function extracts the entry of the specified terminal type TERM\n(defaults to the environment variable TERM) from the database.\n\nIt will look in the environment for a TERMCAP variable.  If found,\nand the value does not begin with a slash, and the terminal type\nname is the same as the environment string TERM, the TERMCAP string\nis used instead of reading a termcap file.  If it does begin with a\nslash, the string is used as a path name of the termcap file to\nsearch.  If TERMCAP does not begin with a slash and name is\ndifferent from TERM, Tgetent searches the files $HOME/.termcap,\n/etc/termcap, and /usr/share/misc/termcap, in that order, unless\nthe environment variable TERMPATH exists, in which case it\nspecifies a list of file pathnames (separated by spaces or colons)\nto be searched instead.  Whenever multiple files are searched and a\ntc field occurs in the requested entry, the entry it names must be\nfound in the same file or one of the succeeding files.  If there is\na \":tc=...:\" in the TERMCAP environment variable string it will\ncontinue the search in the files as above.\n\nThe extracted termcap entry is available in the object as\n\"$self->{TERMCAP}\".\n\nIt takes a hash reference as an argument with two optional keys:\n\nOSPEED\nThe terminal output bit rate (often mistakenly called the baud\nrate) for this terminal - if not set a warning will be generated\nand it will be defaulted to 9600.  OSPEED can be specified as\neither a POSIX termios/SYSV termio speeds (where 9600 equals\n9600) or an old DSD-style speed ( where 13 equals 9600).\n\nTERM\nThe terminal type whose termcap entry will be used - if not\nsupplied it will default to $ENV{TERM}: if that is not set then\nTgetent will croak.\n\nIt calls \"croak\" on failure.\n\nTpad\nOutputs a literal string with appropriate padding for the current\nterminal.\n\nIt takes three arguments:\n\n$string\nThe literal string to be output.  If it starts with a number and\nan optional '*' then the padding will be increased by an amount\nrelative to this number, if the '*' is present then this amount\nwill be multiplied by $cnt.  This part of $string is removed\nbefore output/\n\n$cnt\nWill be used to modify the padding applied to string as described\nabove.\n\n$FH\nAn optional filehandle (or IO::Handle ) that output will be\nprinted to.\n\nThe padded $string is returned.\n\nTputs\nOutput the string for the given capability padded as appropriate\nwithout any parameter substitution.\n\nIt takes three arguments:\n\n$cap\nThe capability whose string is to be output.\n\n$cnt\nA count passed to Tpad to modify the padding applied to the\noutput string.  If $cnt is zero or one then the resulting string\nwill be cached.\n\n$FH\nAn optional filehandle (or IO::Handle ) that output will be\nprinted to.\n\nThe appropriate string for the capability will be returned.\n\nTgoto\nTgoto decodes a cursor addressing string with the given parameters.\n\nThere are four arguments:\n\n$cap\nThe name of the capability to be output.\n\n$col\nThe first value to be substituted in the output string ( usually\nthe column in a cursor addressing capability )\n\n$row\nThe second value to be substituted in the output string (usually\nthe row in cursor addressing capabilities)\n\n$FH\nAn optional filehandle (or IO::Handle ) to which the output\nstring will be printed.\n\nSubstitutions are made with $col and $row in the output string with\nthe following sprintf() line formats:\n\n%%   output `%'\n%d   output value as in printf %d\n%2   output value as in printf %2d\n%3   output value as in printf %3d\n%.   output value as in printf %c\n%+x  add x to value, then do %.\n\n%>xy if value > x then add y, no output\n%r   reverse order of two parameters, no output\n%i   increment by one, no output\n%B   BCD (16*(value/10)) + (value%10), no output\n\n%n   exclusive-or all parameters with 0140 (Datamedia 2500)\n%D   Reverse coding (value - 2*(value%16)), no output (Delta Data)\n\nThe output string will be returned.\n\nTrequire\nTakes a list of capabilities as an argument and will croak if one\nis not found.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "use Term::Cap;\n\n# Get terminal output speed\nrequire POSIX;\nmy $termios = new POSIX::Termios;\n$termios->getattr;\nmy $ospeed = $termios->getospeed;\n\n# Old-style ioctl code to get ospeed:\n#     require 'ioctl.pl';\n#     ioctl(TTY,$TIOCGETP,$sgtty);\n#     ($ispeed,$ospeed) = unpack('cc',$sgtty);\n\n# allocate and initialize a terminal structure\n$terminal = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };\n\n# require certain capabilities to be available\n$terminal->Trequire(qw/ce ku kd/);\n\n# Output Routines, if $FH is undefined these just return the string\n\n# Tgoto does the % expansion stuff with the given args\n$terminal->Tgoto('cm', $col, $row, $FH);\n\n# Tputs doesn't do any % expansion.\n$terminal->Tputs('dl', $count = 1, $FH);\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENSE": {
                "content": "Copyright 1995-2015 (c) perl5 porters.\n\nThis software is free software and can be modified and distributed\nunder the same terms as Perl itself.\n\nPlease see the file README in the Perl source distribution for details\nof the Perl license.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "This module is part of the core Perl distribution and is also\nmaintained for CPAN by Jonathan Stowe <jns@gellyfish.co.uk>.\n\nThe code is hosted on Github: https://github.com/jonathanstowe/Term-Cap\nplease feel free to fork, submit patches etc, etc there.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "termcap(5)\n\nperl v5.34.0                      2026-06-23                  Term::Cap(3perl)",
                "subsections": []
            }
        }
    }
}