{
    "content": [
        {
            "type": "text",
            "text": "# IO::File (perldoc)\n\n## NAME\n\nIO::File - supply object methods for filehandles\n\n## SYNOPSIS\n\nuse IO::File;\n$fh = IO::File->new();\nif ($fh->open(\"< file\")) {\nprint <$fh>;\n$fh->close;\n}\n$fh = IO::File->new(\"> file\");\nif (defined $fh) {\nprint $fh \"bar\\n\";\n$fh->close;\n}\n$fh = IO::File->new(\"file\", \"r\");\nif (defined $fh) {\nprint <$fh>;\nundef $fh;       # automatically closes the file\n}\n$fh = IO::File->new(\"file\", OWRONLY|OAPPEND);\nif (defined $fh) {\nprint $fh \"corge\\n\";\n$pos = $fh->getpos;\n$fh->setpos($pos);\nundef $fh;       # automatically closes the file\n}\nautoflush STDOUT 1;\n\n## DESCRIPTION\n\n\"IO::File\" inherits from \"IO::Handle\" and \"IO::Seekable\". It extends these classes with methods\nthat are specific to file handles.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **CONSTRUCTOR**\n- **METHODS** (3 subsections)\n- **NOTE**\n- **SEE ALSO**\n- **HISTORY**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "IO::File",
        "section": "",
        "mode": "perldoc",
        "summary": "IO::File - supply object methods for filehandles",
        "synopsis": "use IO::File;\n$fh = IO::File->new();\nif ($fh->open(\"< file\")) {\nprint <$fh>;\n$fh->close;\n}\n$fh = IO::File->new(\"> file\");\nif (defined $fh) {\nprint $fh \"bar\\n\";\n$fh->close;\n}\n$fh = IO::File->new(\"file\", \"r\");\nif (defined $fh) {\nprint <$fh>;\nundef $fh;       # automatically closes the file\n}\n$fh = IO::File->new(\"file\", OWRONLY|OAPPEND);\nif (defined $fh) {\nprint $fh \"corge\\n\";\n$pos = $fh->getpos;\n$fh->setpos($pos);\nundef $fh;       # automatically closes the file\n}\nautoflush STDOUT 1;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 32,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "CONSTRUCTOR",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "open",
                        "lines": 1
                    },
                    {
                        "name": "open",
                        "lines": 18
                    },
                    {
                        "name": "binmode",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "NOTE",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "IO::File - supply object methods for filehandles\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use IO::File;\n\n$fh = IO::File->new();\nif ($fh->open(\"< file\")) {\nprint <$fh>;\n$fh->close;\n}\n\n$fh = IO::File->new(\"> file\");\nif (defined $fh) {\nprint $fh \"bar\\n\";\n$fh->close;\n}\n\n$fh = IO::File->new(\"file\", \"r\");\nif (defined $fh) {\nprint <$fh>;\nundef $fh;       # automatically closes the file\n}\n\n$fh = IO::File->new(\"file\", OWRONLY|OAPPEND);\nif (defined $fh) {\nprint $fh \"corge\\n\";\n\n$pos = $fh->getpos;\n$fh->setpos($pos);\n\nundef $fh;       # automatically closes the file\n}\n\nautoflush STDOUT 1;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "\"IO::File\" inherits from \"IO::Handle\" and \"IO::Seekable\". It extends these classes with methods\nthat are specific to file handles.\n",
                "subsections": []
            },
            "CONSTRUCTOR": {
                "content": "new ( FILENAME [,MODE [,PERMS]] )\nCreates an \"IO::File\". If it receives any parameters, they are passed to the method \"open\";\nif the open fails, the object is destroyed. Otherwise, it is returned to the caller.\n\nnewtmpfile\nCreates an \"IO::File\" opened for read/write on a newly created temporary file. On systems\nwhere this is possible, the temporary file is anonymous (i.e. it is unlinked after creation,\nbut held open). If the temporary file cannot be created or opened, the \"IO::File\" object is\ndestroyed. Otherwise, it is returned to the caller.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "open",
                        "content": ""
                    },
                    {
                        "name": "open",
                        "content": "\"open\" accepts one, two or three parameters. With one parameter, it is just a front end for\nthe built-in \"open\" function. With two or three parameters, the first parameter is a\nfilename that may include whitespace or other special characters, and the second parameter\nis the open mode, optionally followed by a file permission value.\n\nIf \"IO::File::open\" receives a Perl mode string (\">\", \"+<\", etc.) or an ANSI C fopen() mode\nstring (\"w\", \"r+\", etc.), it uses the basic Perl \"open\" operator (but protects any special\ncharacters).\n\nIf \"IO::File::open\" is given a numeric mode, it passes that mode and the optional\npermissions value to the Perl \"sysopen\" operator. The permissions default to 0666.\n\nIf \"IO::File::open\" is given a mode that includes the \":\" character, it passes all the three\narguments to the three-argument \"open\" operator.\n\nFor convenience, \"IO::File\" exports the OXXX constants from the Fcntl module, if this\nmodule is available.\n"
                    },
                    {
                        "name": "binmode",
                        "content": "\"binmode\" sets \"binmode\" on the underlying \"IO\" object, as documented in \"perldoc -f\nbinmode\".\n\n\"binmode\" accepts one optional parameter, which is the layer to be passed on to the\n\"binmode\" call.\n"
                    }
                ]
            },
            "NOTE": {
                "content": "Some operating systems may perform \"IO::File::new()\" or \"IO::File::open()\" on a directory\nwithout errors. This behavior is not portable and not suggested for use. Using \"opendir()\" and\n\"readdir()\" or \"IO::Dir\" are suggested instead.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "perlfunc, \"I/O Operators\" in perlop, IO::Handle, IO::Seekable, IO::Dir\n",
                "subsections": []
            },
            "HISTORY": {
                "content": "Derived from FileHandle.pm by Graham Barr <gbarr@pobox.com>.\n",
                "subsections": []
            }
        }
    }
}