{
    "mode": "perldoc",
    "parameter": "autouse",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/autouse/json",
    "generated": "2026-07-05T11:50:54Z",
    "synopsis": "use autouse 'Carp' => qw(carp croak);\ncarp \"this carp was predeclared and autoused \";",
    "sections": {
        "NAME": {
            "content": "autouse - postpone load of modules until a function is used\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use autouse 'Carp' => qw(carp croak);\ncarp \"this carp was predeclared and autoused \";\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "If the module \"Module\" is already loaded, then the declaration\n\nuse autouse 'Module' => qw(func1 func2($;$));\n\nis equivalent to\n\nuse Module qw(func1 func2);\n\nif \"Module\" defines func2() with prototype \"($;$)\", and func1() has no prototypes. (At least if\n\"Module\" uses \"Exporter\"'s \"import\", otherwise it is a fatal error.)\n\nIf the module \"Module\" is not loaded yet, then the above declaration declares functions func1()\nand func2() in the current package. When these functions are called, they load the package\n\"Module\" if needed, and substitute themselves with the correct definitions.\n",
            "subsections": []
        },
        "WARNING": {
            "content": "Using \"autouse\" will move important steps of your program's execution from compile time to\nruntime. This can\n\n*   Break the execution of your program if the module you \"autouse\"d has some initialization\nwhich it expects to be done early.\n\n*   hide bugs in your code since important checks (like correctness of prototypes) is moved from\ncompile time to runtime. In particular, if the prototype you specified on \"autouse\" line is\nwrong, you will not find it out until the corresponding function is executed. This will be\nvery unfortunate for functions which are not always called (note that for such functions\n\"autouse\"ing gives biggest win, for a workaround see below).\n\nTo alleviate the second problem (partially) it is advised to write your scripts like this:\n\nuse Module;\nuse autouse Module => qw(carp($) croak(&$));\ncarp \"this carp was predeclared and autoused \";\n\nThe first line ensures that the errors in your argument specification are found early. When you\nship your application you should comment out the first line, since it makes the second one\nuseless.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Ilya Zakharevich (ilya@math.ohio-state.edu)\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "",
            "subsections": [
                {
                    "name": "perl",
                    "content": ""
                }
            ]
        }
    },
    "summary": "autouse - postpone load of modules until a function is used",
    "flags": [],
    "examples": [],
    "see_also": []
}