{
    "content": [
        {
            "type": "text",
            "text": "# autodie::Util (perldoc)\n\n## NAME\n\nautodie::Util - Internal Utility subroutines for autodie and Fatal\n\n## SYNOPSIS\n\n# INTERNAL API for autodie and Fatal only!\nuse autodie::Util qw(onendofcompilescope);\nonendofcompilescope(sub { print \"Hallo world\\n\"; });\n\n## DESCRIPTION\n\nInteral Utilities for autodie and Fatal! This module is not a part of autodie's public API.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (1 subsections)\n- **AUTHOR**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "autodie::Util",
        "section": "",
        "mode": "perldoc",
        "summary": "autodie::Util - Internal Utility subroutines for autodie and Fatal",
        "synopsis": "# INTERNAL API for autodie and Fatal only!\nuse autodie::Util qw(onendofcompilescope);\nonendofcompilescope(sub { print \"Hallo world\\n\"; });",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 8,
                "subsections": [
                    {
                        "name": "Methods",
                        "lines": 38
                    }
                ]
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "autodie::Util - Internal Utility subroutines for autodie and Fatal\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "# INTERNAL API for autodie and Fatal only!\n\nuse autodie::Util qw(onendofcompilescope);\nonendofcompilescope(sub { print \"Hallo world\\n\"; });\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Interal Utilities for autodie and Fatal! This module is not a part of autodie's public API.\n\nThis module contains utility subroutines for abstracting away the underlying magic of autodie\nand (ab)uses of \"%^H\" to call subs at the end of a (compile-time) scopes.\n\nNote that due to how \"%^H\" works, some of these utilities are only useful during the compilation\nphase of a perl module and relies on the internals of how perl handles references in \"%^H\".\n",
                "subsections": [
                    {
                        "name": "Methods",
                        "content": "onendofcompilescope\nonendofcompilescope(sub { print \"Hallo world\\n\"; });\n\nWill invoke a sub at the end of a (compile-time) scope. The sub is called once with no\narguments. Can be called multiple times (even in the same \"compile-time\" scope) to install\nmultiple subs. Subs are called in a \"first-in-last-out\"-order (FILO or \"stack\"-order).\n\nfillprotos\nfillprotos('*$$;$@')\n\nGiven a Perl subroutine prototype, return a list of invocation specifications. Each\nspecification is a listref, where the first member is the (minimum) number of arguments for this\ninvocation specification. The remaining arguments are a string representation of how to pass the\narguments correctly to a sub with the given prototype, when called with the given number of\narguments.\n\nThe specifications are returned in increasing order of arguments starting at 0 (e.g. ';$') or 1\n(e.g. '$@'). Note that if the prototype is \"slurpy\" (e.g. ends with a \"@\"), the number of\narguments for the last specification is a \"minimum\" number rather than an exact number. This can\nbe detected by the last member of the last specification matching m/[@#]/.\n\nmakecoretrampoline\nmakecoretrampoline('CORE::open', 'main', prototype('CORE::open'))\n\nCreates a trampoline for calling a core sub. Essentially, a tiny sub that figures out how we\nshould be calling our core sub, puts in the arguments in the right way, and bounces our control\nover to it.\n\nIf we could reliably use `goto &` on core builtins, we wouldn't need this subroutine.\n\ninstallsubs\ninstallsubs('My::Module', { 'read' => sub { die(\"Hallo\\n\"), ... }})\n\nGiven a package name and a hashref mapping names to a subroutine reference (or \"undef\"), this\nsubroutine will install said subroutines on their given name in that module. If a name mapes to\n\"undef\", any subroutine with that name in the target module will be remove (possibly\n\"unshadowing\" a CORE sub of same name).\n"
                    }
                ]
            },
            "AUTHOR": {
                "content": "Copyright 2013-2014, Niels Thykier <niels@thykier.net>\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "This module is free software. You may distribute it under the same terms as Perl itself.\n",
                "subsections": []
            }
        }
    }
}