{
    "content": [
        {
            "type": "text",
            "text": "# IO::Tee (perldoc)\n\n## NAME\n\nIO::Tee - Multiplex output to multiple output handles\n\n## SYNOPSIS\n\nuse IO::Tee;\n$tee = IO::Tee->new($handle1, $handle2);\nprint $tee \"foo\", \"bar\";\nmy $input = <$tee>;\n\n## DESCRIPTION\n\n\"IO::Tee\" objects can be used to multiplex input and output in two different ways. The first way\nis to multiplex output to zero or more output handles. The \"IO::Tee\" constructor, given a list\nof output handles, returns a tied handle that can be written to. When written to (using print or\nprintf), the \"IO::Tee\" object multiplexes the output to the list of handles originally passed to\nthe constructor. As a shortcut, you can also directly pass a string or an array reference to the\nconstructor, in which case \"IO::File::new\" is called for you with the specified argument or\narguments.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **EXAMPLE**\n- **REPOSITORY**\n- **AUTHOR**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "IO::Tee",
        "section": "",
        "mode": "perldoc",
        "summary": "IO::Tee - Multiplex output to multiple output handles",
        "synopsis": "use IO::Tee;\n$tee = IO::Tee->new($handle1, $handle2);\nprint $tee \"foo\", \"bar\";\nmy $input = <$tee>;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "use IO::Tee;",
            "use IO::File;",
            "my $tee = new IO::Tee(\\*STDOUT,",
            "new IO::File(\">tt1.out\"), \">tt2.out\");",
            "print join(' ', $tee->handles), \"\\n\";",
            "for (1..10) { print $tee $, \"\\n\" }",
            "for (1..10) { $tee->print($, \"\\n\") }",
            "$tee->flush;",
            "$tee = new IO::Tee('</etc/passwd', \\*STDOUT);",
            "my @lines = <$tee>;",
            "print scalar(@lines);"
        ],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 69,
                "subsections": []
            },
            {
                "name": "EXAMPLE",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "REPOSITORY",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "IO::Tee - Multiplex output to multiple output handles\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use IO::Tee;\n\n$tee = IO::Tee->new($handle1, $handle2);\nprint $tee \"foo\", \"bar\";\nmy $input = <$tee>;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "\"IO::Tee\" objects can be used to multiplex input and output in two different ways. The first way\nis to multiplex output to zero or more output handles. The \"IO::Tee\" constructor, given a list\nof output handles, returns a tied handle that can be written to. When written to (using print or\nprintf), the \"IO::Tee\" object multiplexes the output to the list of handles originally passed to\nthe constructor. As a shortcut, you can also directly pass a string or an array reference to the\nconstructor, in which case \"IO::File::new\" is called for you with the specified argument or\narguments.\n\nThe second way is to multiplex input from one input handle to zero or more output handles as it\nis being read. The \"IO::Tee\" constructor, given an input handle followed by a list of output\nhandles, returns a tied handle that can be read from as well as written to. When written to, the\n\"IO::Tee\" object multiplexes the output to all handles passed to the constructor, as described\nin the previous paragraph. When read from, the \"IO::Tee\" object reads from the input handle\ngiven as the first argument to the \"IO::Tee\" constructor, then writes any data read to the\noutput handles given as the remaining arguments to the constructor.\n\nThe \"IO::Tee\" class supports certain \"IO::Handle\" and \"IO::File\" methods related to input and\noutput. In particular, the following methods will iterate themselves over all handles associated\nwith the \"IO::Tee\" object, and return TRUE indicating success if and only if all associated\nhandles returned TRUE indicating success:\n\nclose\ntruncate\nwrite\nsyswrite\nformatwrite\nformline\nfcntl\nioctl\nflush\nclearerr\nseek\n\nThe following methods perform input multiplexing as described above:\n\nread\nsysread\nreadline\ngetc\ngets\neof\ngetline\ngetlines\n\nThe following methods can be used to set (but not retrieve) the current values of output-related\nstate variables on all associated handles:\n\nautoflush\noutputfieldseparator\noutputrecordseparator\nformatpagenumber\nformatlinesperpage\nformatlinesleft\nformatname\nformattopname\nformatlinebreakcharacters\nformatformfeed\n\nThe following methods are directly passed on to the input handle given as the first argument to\nthe \"IO::Tee\" constructor:\n\ninputrecordseparator\ninputlinenumber\n\nNote that the return value of input multiplexing methods (such as \"print\") is always the return\nvalue of the input action, not the return value of subsequent output actions. In particular, no\nerror is indicated by the return value if the input action itself succeeds but subsequent output\nmultiplexing fails.\n",
                "subsections": []
            },
            "EXAMPLE": {
                "content": "use IO::Tee;\nuse IO::File;\n\nmy $tee = new IO::Tee(\\*STDOUT,\nnew IO::File(\">tt1.out\"), \">tt2.out\");\n\nprint join(' ', $tee->handles), \"\\n\";\n\nfor (1..10) { print $tee $, \"\\n\" }\nfor (1..10) { $tee->print($, \"\\n\") }\n$tee->flush;\n\n$tee = new IO::Tee('</etc/passwd', \\*STDOUT);\nmy @lines = <$tee>;\nprint scalar(@lines);\n",
                "subsections": []
            },
            "REPOSITORY": {
                "content": "<https://github.com/neilb/IO-Tee>\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Chung-chieh Shan, ken@digitas.harvard.edu\n\nAs of August 2017, now being maintained by Neil Bowers.\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (c) 1998-2017 Chung-chieh Shan. All rights reserved. This program is free software;\nyou can redistribute it and/or modify it under the same terms as Perl itself.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "perlfunc, IO::Handle, IO::File.\n",
                "subsections": []
            }
        }
    }
}