{
    "content": [
        {
            "type": "text",
            "text": "# IO::Pty (perldoc)\n\n## NAME\n\nIO::Pty - Pseudo TTY object class\n\n## SYNOPSIS\n\nuse IO::Pty;\n$pty = new IO::Pty;\n$slave  = $pty->slave;\nforeach $val (1..10) {\nprint $pty \"$val\\n\";\n$ = <$slave>;\nprint \"$\";\n}\nclose($slave);\n\n## DESCRIPTION\n\n\"IO::Pty\" provides an interface to allow the creation of a pseudo tty.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **CONSTRUCTOR**\n- **METHODS** (8 subsections)\n- **SEE ALSO**\n- **MAILING LISTS**\n- **AUTHORS**\n- **COPYRIGHT**\n- **DISCLAIMER**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "IO::Pty",
        "section": "",
        "mode": "perldoc",
        "summary": "IO::Pty - Pseudo TTY object class",
        "synopsis": "use IO::Pty;\n$pty = new IO::Pty;\n$slave  = $pty->slave;\nforeach $val (1..10) {\nprint $pty \"$val\\n\";\n$ = <$slave>;\nprint \"$\";\n}\nclose($slave);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "CONSTRUCTOR",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "ttyname",
                        "lines": 4
                    },
                    {
                        "name": "slave",
                        "lines": 4
                    },
                    {
                        "name": "close_slave",
                        "lines": 4
                    },
                    {
                        "name": "make_slave_controlling_terminal",
                        "lines": 5
                    },
                    {
                        "name": "set_raw",
                        "lines": 10
                    },
                    {
                        "name": "clone_winsize_from",
                        "lines": 12
                    },
                    {
                        "name": "get_winsize",
                        "lines": 4
                    },
                    {
                        "name": "set_winsize",
                        "lines": 3
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "MAILING LISTS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "DISCLAIMER",
                "lines": 18,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "IO::Pty - Pseudo TTY object class\n",
                "subsections": []
            },
            "VERSION": {
                "content": "1.15\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use IO::Pty;\n\n$pty = new IO::Pty;\n\n$slave  = $pty->slave;\n\nforeach $val (1..10) {\nprint $pty \"$val\\n\";\n$ = <$slave>;\nprint \"$\";\n}\n\nclose($slave);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "\"IO::Pty\" provides an interface to allow the creation of a pseudo tty.\n\n\"IO::Pty\" inherits from \"IO::Handle\" and so provide all the methods defined by the \"IO::Handle\"\npackage.\n\nPlease note that pty creation is very system-dependent. If you have problems, see IO::Tty for\nhelp.\n",
                "subsections": []
            },
            "CONSTRUCTOR": {
                "content": "new\nThe \"new\" constructor takes no arguments and returns a new file object which is the master\nside of the pseudo tty.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "ttyname",
                        "content": "Returns the name of the slave pseudo tty. On UNIX machines this will be the pathname of the\ndevice. Use this name for informational purpose only, to get a slave filehandle, use\nslave().\n"
                    },
                    {
                        "name": "slave",
                        "content": "The \"slave\" method will return the slave filehandle of the given master pty, opening it anew\nif necessary. If IO::Stty is installed, you can then call \"$slave->stty()\" to modify the\nterminal settings.\n"
                    },
                    {
                        "name": "close_slave",
                        "content": "The slave filehandle will be closed and destroyed. This is necessary in the parent after\nforking to get rid of the open filehandle, otherwise the parent will not notice if the child\nexits. Subsequent calls of \"slave()\" will return a newly opened slave filehandle.\n"
                    },
                    {
                        "name": "make_slave_controlling_terminal",
                        "content": "This will set the slave filehandle as the controlling terminal of the current process, which\nwill become a session leader, so this should only be called by a child process after a\nfork(), e.g. in the callback to \"syncexec()\" (see Proc::SyncExec). See the \"try\" script\n(also \"test.pl\") for an example how to correctly spawn a subprocess.\n"
                    },
                    {
                        "name": "set_raw",
                        "content": "Will set the pty to raw. Note that this is a one-way operation, you need IO::Stty to set the\nterminal settings to anything else.\n\nOn some systems, the master pty is not a tty. This method checks for that and returns\nsuccess anyway on such systems. Note that this method must be called on the slave, and\nprobably should be called on the master, just to be sure, i.e.\n\n$pty->slave->setraw();\n$pty->setraw();\n"
                    },
                    {
                        "name": "clone_winsize_from",
                        "content": "Gets the terminal size from filehandle FH (which must be a terminal) and transfers it to the\npty. Returns true on success and undef on failure. Note that this must be called upon the\n*slave*, i.e.\n\n$pty->slave->clonewinsizefrom(\\*STDIN);\n\nOn some systems, the master pty also isatty. I actually have no idea if setting terminal\nsizes there is passed through to the slave, so if this method is called for a master that is\nnot a tty, it silently returns OK.\n\nSee the \"try\" script for example code how to propagate SIGWINCH.\n"
                    },
                    {
                        "name": "get_winsize",
                        "content": "Returns the terminal size, in a 4-element list.\n\n($row, $col, $xpixel, $ypixel) = $tty->getwinsize()\n"
                    },
                    {
                        "name": "set_winsize",
                        "content": "Sets the terminal size. If not specified, $xpixel and $ypixel are set to 0. As with\n\"clonewinsizefrom\", this must be called upon the *slave*.\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "IO::Tty, IO::Tty::Constant, IO::Handle, Expect, Proc::SyncExec\n",
                "subsections": []
            },
            "MAILING LISTS": {
                "content": "As this module is mainly used by Expect, support for it is available via the two Expect mailing\nlists, expectperl-announce and expectperl-discuss, at\n\nhttp://lists.sourceforge.net/lists/listinfo/expectperl-announce\n\nand\n\nhttp://lists.sourceforge.net/lists/listinfo/expectperl-discuss\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "Originally by Graham Barr <gbarr@pobox.com>, based on the Ptty module by Nick Ing-Simmons\n<nik@tiuk.ti.com>.\n\nNow maintained and heavily rewritten by Roland Giersig <RGiersig@cpan.org>.\n\nContains copyrighted stuff from openssh v3.0p1, authored by Tatu Ylonen <ylo@cs.hut.fi>, Markus\nFriedl and Todd C. Miller <Todd.Miller@courtesan.com>.\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Now all code is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n\nNevertheless the above AUTHORS retain their copyrights to the various parts and want to receive\ncredit if their source code is used. See the source for details.\n",
                "subsections": []
            },
            "DISCLAIMER": {
                "content": "THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\nTHE POSSIBILITY OF SUCH DAMAGE.\n\nIn other words: Use at your own risk. Provided as is. Your mileage may vary. Read the source,\nLuke!\n\nAnd finally, just to be sure:\n\nAny Use of This Product, in Any Manner Whatsoever, Will Increase the Amount of Disorder in the\nUniverse. Although No Liability Is Implied Herein, the Consumer Is Warned That This Process Will\nUltimately Lead to the Heat Death of the Universe.\n",
                "subsections": []
            }
        }
    }
}