{
    "mode": "perldoc",
    "parameter": "Module::Load",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Module%3A%3ALoad/json",
    "generated": "2026-07-05T22:21:49Z",
    "synopsis": "use Module::Load;\nmy $module = 'Data::Dumper';\nload Data::Dumper;     # loads that module, but not import any functions\n# -> cannot use 'Dumper' function\nload 'Data::Dumper';   # ditto\nload $module           # tritto\nautoload Data::Dumper; # loads that module and imports the default functions\n# -> can use 'Dumper' function\nmy $script = 'some/script.pl'\nload $script;\nload 'some/script.pl';  # use quotes because of punctuations\nload thing;             # try 'thing' first, then 'thing.pm'\nload CGI, ':all';       # like 'use CGI qw[:standard]'",
    "sections": {
        "NAME": {
            "content": "Module::Load - runtime require of both modules and files\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Module::Load;\n\nmy $module = 'Data::Dumper';\n\nload Data::Dumper;     # loads that module, but not import any functions\n# -> cannot use 'Dumper' function\n\nload 'Data::Dumper';   # ditto\nload $module           # tritto\n\nautoload Data::Dumper; # loads that module and imports the default functions\n# -> can use 'Dumper' function\n\nmy $script = 'some/script.pl'\nload $script;\nload 'some/script.pl';  # use quotes because of punctuations\n\nload thing;             # try 'thing' first, then 'thing.pm'\n\nload CGI, ':all';       # like 'use CGI qw[:standard]'\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "\"Module::Load\" eliminates the need to know whether you are trying to require either a file or a\nmodule.\n\nIf you consult \"perldoc -f require\" you will see that \"require\" will behave differently when\ngiven a bareword or a string.\n\nIn the case of a string, \"require\" assumes you are wanting to load a file. But in the case of a\nbareword, it assumes you mean a module.\n\nThis gives nasty overhead when you are trying to dynamically require modules at runtime, since\nyou will need to change the module notation (\"Acme::Comment\") to a file notation fitting the\nparticular platform you are on.\n\n\"Module::Load\" eliminates the need for this overhead and will just DWYM.\n\nDifference between \"load\" and \"autoload\"\n\"Module::Load\" imports the two functions - \"load\" and \"autoload\"\n\n\"autoload\" imports the default functions automatically, but \"load\" do not import any functions.\n\n\"autoload\" is usable under \"BEGIN{};\".\n\nBoth the functions can import the functions that are specified.\n\nFollowing codes are same.\n\nload File::Spec::Functions, qw/splitpath/;\n\nautoload File::Spec::Functions, qw/splitpath/;\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "load\nLoads a specified module.\n\nSee \"Rules\" for detailed loading rule.\n\nautoload\nLoads a specified module and imports the default functions.\n\nExcept importing the functions, 'autoload' is same as 'load'.\n\nloadremote\nLoads a specified module to the specified package.\n\nuse Module::Load 'loadremote';\n\nmy $pkg = 'Other::Package';\n\nloadremote $pkg, 'Data::Dumper'; # load a module to 'Other::Package'\n# but do not import 'Dumper' function\n\nA module for loading must be quoted.\n\nExcept specifing the package and quoting module name, 'loadremote' is same as 'load'.\n\nautoloadremote\nLoads a specified module and imports the default functions to the specified package.\n\nuse Module::Load 'autoloadremote';\n\nmy $pkg = 'Other::Package';\n\nautoloadremote $pkg, 'Data::Dumper'; # load a module to 'Other::Package'\n# and imports 'Dumper' function\n\nA module for loading must be quoted.\n\nExcept specifing the package and quoting module name, 'autoloadremote' is same as\n'loadremote'.\n",
            "subsections": []
        },
        "Rules": {
            "content": "All functions have the following rules to decide what it thinks you want:\n\n*   If the argument has any characters in it other than those matching \"\\w\", \":\" or \"'\", it must\nbe a file\n\n*   If the argument matches only \"[\\w:']\", it must be a module\n\n*   If the argument matches only \"\\w\", it could either be a module or a file. We will try to\nfind \"file.pm\" first in @INC and if that fails, we will try to find \"file\" in @INC. If both\nfail, we die with the respective error messages.\n",
            "subsections": []
        },
        "IMPORTS THE FUNCTIONS": {
            "content": "'load' and 'autoload' are imported by default, but 'loadremote' and 'autoloadremote' are not\nimported.\n\nTo use 'loadremote' or 'autoloadremote', specify at 'use'.\n\n\"load\",\"autoload\",\"loadremote\",\"autoloadremote\"\nImports the selected functions.\n\n# imports 'load' and 'autoload' (default)\nuse Module::Load;\n\n# imports 'autoload' only\nuse Module::Load 'autoload';\n\n# imports 'autoload' and 'autoloadremote', but don't import 'load';\nuse Module::Load qw/autoload autoloadremote/;\n\n'all'\nImports all the functions.\n\nuse Module::Load 'all'; # imports load, autoload, loadremote, autoloadremote\n\n'','none',undef\nNot import any functions (\"load\" and \"autoload\" are not imported).\n\nuse Module::Load '';\n\nuse Module::Load 'none';\n\nuse Module::Load undef;\n",
            "subsections": []
        },
        "Caveats": {
            "content": "Because of a bug in perl (#19213), at least in version 5.6.1, we have to hardcode the path\nseparator for a require on Win32 to be \"/\", like on Unix rather than the Win32 \"\\\". Otherwise\nperl will not read its own %INC accurately double load files if they are required again, or in\nthe worst case, core dump.\n\n\"Module::Load\" cannot do implicit imports, only explicit imports. (in other words, you always\nhave to specify explicitly what you wish to import from a module, even if the functions are in\nthat modules' @EXPORT)\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Module::Runtime provides functions for loading modules, checking the validity of a module name,\nconverting a module name to partial \".pm\" path, and related utility functions.\n\n\"require\" in perlfunc <https://metacpan.org/pod/perlfunc#require> and \"use\" in perlfunc\n<https://metacpan.org/pod/perlfunc#use>.\n\nMojo::Loader is a \"class loader and plugin framework\", and is included in the Mojolicious\n<https://metacpan.org/release/Mojolicious> distribution.\n\nModule::Loader is a module for finding and loading modules in a given namespace, inspired by\n\"Mojo::Loader\".\n",
            "subsections": []
        },
        "ACKNOWLEDGEMENTS": {
            "content": "Thanks to Jonas B. Nielsen for making explicit imports work.\n",
            "subsections": []
        },
        "BUG REPORTS": {
            "content": "Please report bugs or other issues to <bug-module-load@rt.cpan.org>.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "This module by Jos Boumans <kane@cpan.org>.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "This library is free software; you may redistribute and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        }
    },
    "summary": "Module::Load - runtime require of both modules and files",
    "flags": [],
    "examples": [],
    "see_also": []
}