{
    "content": [
        {
            "type": "text",
            "text": "# Fatal (man)\n\n## NAME\n\nFatal - Replace functions with equivalents which succeed or die\n\n## SYNOPSIS\n\nuse Fatal qw(open close);\nopen(my $fh, \"<\", $filename);  # No need to check errors!\nuse File::Copy qw(move);\nuse Fatal qw(move);\nmove($file1, $file2); # No need to check errors!\nsub juggle { . . . }\nFatal->import('juggle');\n\n## DESCRIPTION\n\n\"Fatal\" provides a way to conveniently replace functions which normally return a false value\nwhen they fail with equivalents which raise exceptions if they are not successful.  This lets\nyou use these functions without having to test their return values explicitly on each call.\nExceptions can be caught using \"eval{}\".  See perlfunc and perlvar for details.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **BEST PRACTICE**\n- **DESCRIPTION**\n- **DIAGNOSTICS**\n- **BUGS**\n- **AUTHOR**\n- **LICENSE**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Fatal",
        "section": "",
        "mode": "man",
        "summary": "Fatal - Replace functions with equivalents which succeed or die",
        "synopsis": "use Fatal qw(open close);\nopen(my $fh, \"<\", $filename);  # No need to check errors!\nuse File::Copy qw(move);\nuse Fatal qw(move);\nmove($file1, $file2); # No need to check errors!\nsub juggle { . . . }\nFatal->import('juggle');",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "BEST PRACTICE",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 28,
                "subsections": []
            },
            {
                "name": "DIAGNOSTICS",
                "lines": 21,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Fatal - Replace functions with equivalents which succeed or die\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Fatal qw(open close);\n\nopen(my $fh, \"<\", $filename);  # No need to check errors!\n\nuse File::Copy qw(move);\nuse Fatal qw(move);\n\nmove($file1, $file2); # No need to check errors!\n\nsub juggle { . . . }\nFatal->import('juggle');\n",
                "subsections": []
            },
            "BEST PRACTICE": {
                "content": "Fatal has been obsoleted by the new autodie pragma. Please use autodie in preference to\n\"Fatal\".  autodie supports lexical scoping, throws real exception objects, and provides much\nnicer error messages.\n\nThe use of \":void\" with Fatal is discouraged.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "\"Fatal\" provides a way to conveniently replace functions which normally return a false value\nwhen they fail with equivalents which raise exceptions if they are not successful.  This lets\nyou use these functions without having to test their return values explicitly on each call.\nExceptions can be caught using \"eval{}\".  See perlfunc and perlvar for details.\n\nThe do-or-die equivalents are set up simply by calling Fatal's \"import\" routine, passing it\nthe names of the functions to be replaced.  You may wrap both user-defined functions and\noverridable CORE operators (except \"exec\", \"system\", \"print\", or any other built-in that\ncannot be expressed via prototypes) in this way.\n\nIf the symbol \":void\" appears in the import list, then functions named later in that import\nlist raise an exception only when these are called in void context--that is, when their\nreturn values are ignored.  For example\n\nuse Fatal qw/:void open close/;\n\n# properly checked, so no exception raised on error\nif (not open(my $fh, '<', '/bogotic') {\nwarn \"Can't open /bogotic: $!\";\n}\n\n# not checked, so error raises an exception\nclose FH;\n\nThe use of \":void\" is discouraged, as it can result in exceptions not being thrown if you\naccidentally call a method without void context.  Use autodie instead if you need to be able\nto disable autodying/Fatal behaviour for a small block of code.\n",
                "subsections": []
            },
            "DIAGNOSTICS": {
                "content": "Bad subroutine name for Fatal: %s\nYou've called \"Fatal\" with an argument that doesn't look like a subroutine name, nor a\nswitch that this version of Fatal understands.\n\n%s is not a Perl subroutine\nYou've asked \"Fatal\" to try and replace a subroutine which does not exist, or has not yet\nbeen defined.\n\n%s is neither a builtin, nor a Perl subroutine\nYou've asked \"Fatal\" to replace a subroutine, but it's not a Perl built-in, and \"Fatal\"\ncouldn't find it as a regular subroutine.  It either doesn't exist or has not yet been\ndefined.\n\nCannot make the non-overridable %s fatal\nYou've tried to use \"Fatal\" on a Perl built-in that can't be overridden, such as \"print\"\nor \"system\", which means that \"Fatal\" can't help you, although some other modules might.\nSee the \"SEE ALSO\" section of this documentation.\n\nInternal error: %s\nYou've found a bug in \"Fatal\".  Please report it using the \"perlbug\" command.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "\"Fatal\" clobbers the context in which a function is called and always makes it a scalar\ncontext, except when the \":void\" tag is used.  This problem does not exist in autodie.\n\n\"Used only once\" warnings can be generated when \"autodie\" or \"Fatal\" is used with package\nfilehandles (eg, \"FILE\").  It's strongly recommended you use scalar filehandles instead.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Original module by Lionel Cons (CERN).\n\nPrototype updates by Ilya Zakharevich <ilya@math.ohio-state.edu>.\n\nautodie support, bugfixes, extended diagnostics, \"system\" support, and major overhauling by\nPaul Fenwick <pjf@perltraining.com.au>\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "This module is free software, you may distribute it under the same terms as Perl itself.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "autodie for a nicer way to use lexical Fatal.\n\nIPC::System::Simple for a similar idea for calls to \"system()\" and backticks.\n\n\n\nperl v5.34.0                                 2025-07-25                                 Fatal(3perl)",
                "subsections": []
            }
        }
    }
}