{
    "content": [
        {
            "type": "text",
            "text": "# Term::Cap (perldoc)\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 terminal capability\n(termcap) database.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **EXAMPLES**\n- **COPYRIGHT AND LICENSE**\n- **AUTHOR**\n- **SEE ALSO** (1 subsections)\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Term::Cap",
        "section": "",
        "mode": "perldoc",
        "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": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 127,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 1,
                "subsections": [
                    {
                        "name": "termcap",
                        "lines": 1
                    }
                ]
            }
        ],
        "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 terminal capability\n(termcap) database.\n\nMore information on the terminal capabilities will be found in the termcap manpage on most\nUnix-like systems.\n\nMETHODS\nThe output strings for Tputs are cached for counts of 1 for performance. Tgoto and Tpad do not\ncache. \"$self->{xx}\" is the raw termcap 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 string to $FH if specified.\n\nTgetent\nReturns a blessed object reference which the user can then use to send the control strings\nto the terminal using Tputs and Tgoto.\n\nThe function extracts the entry of the specified terminal type *TERM* (defaults to the\nenvironment variable *TERM*) from the database.\n\nIt will look in the environment for a *TERMCAP* variable. If found, and the value does not\nbegin with a slash, and the terminal type name is the same as the environment string *TERM*,\nthe *TERMCAP* string is 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 search. If *TERMCAP* does\nnot begin with a slash and name is different from *TERM*, Tgetent searches the files\n$HOME/.termcap, /etc/termcap, and /usr/share/misc/termcap, in that order, unless the\nenvironment variable *TERMPATH* exists, in which case it specifies a list of file pathnames\n(separated by spaces or colons) to be searched instead. Whenever multiple files are searched\nand a tc field occurs in the requested entry, the entry it names must be found in the same\nfile or one of the succeeding files. If there is a \":tc=...:\" in the *TERMCAP* environment\nvariable string it will continue the search in the files as above.\n\nThe extracted termcap entry is available in the object as \"$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 rate) for this terminal -\nif not set a warning will be generated and it will be defaulted to 9600. *OSPEED* can be\nspecified as either a POSIX termios/SYSV termio speeds (where 9600 equals 9600) or an old\nDSD-style speed ( where 13 equals 9600).\n\nTERM\nThe terminal type whose termcap entry will be used - if not supplied it will default to\n$ENV{TERM}: if that is not set then Tgetent will croak.\n\nIt calls \"croak\" on failure.\n\nTpad\nOutputs a literal string with appropriate padding for the current terminal.\n\nIt takes three arguments:\n\n$string\nThe literal string to be output. If it starts with a number and an optional '*' then the\npadding will be increased by an amount relative to this number, if the '*' is present then\nthis amount will be multiplied by $cnt. This part of $string is removed before output/\n\n$cnt\nWill be used to modify the padding applied to string as described above.\n\n$FH\nAn optional filehandle (or IO::Handle ) that output will be printed to.\n\nThe padded $string is returned.\n\nTputs\nOutput the string for the given capability padded as appropriate without any parameter\nsubstitution.\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 output string. If $cnt is zero\nor one then the resulting string will be cached.\n\n$FH\nAn optional filehandle (or IO::Handle ) that output will be printed 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 the column in a cursor\naddressing capability )\n\n$row\nThe second value to be substituted in the output string (usually the row in cursor\naddressing capabilities)\n\n$FH\nAn optional filehandle (or IO::Handle ) to which the output string will be printed.\n\nSubstitutions are made with $col and $row in the output string with the following sprintf()\nline 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 is 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 under the same terms as Perl\nitself.\n\nPlease see the file README in the Perl source distribution for details of the Perl license.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "This module is part of the core Perl distribution and is also maintained for CPAN by Jonathan\nStowe <jns@gellyfish.co.uk>.\n\nThe code is hosted on Github: https://github.com/jonathanstowe/Term-Cap please feel free to\nfork, submit patches etc, etc there.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "",
                "subsections": [
                    {
                        "name": "termcap",
                        "content": ""
                    }
                ]
            }
        }
    }
}