{
    "content": [
        {
            "type": "text",
            "text": "# Module::Load::Conditional (perldoc)\n\n**Summary:** Module::Load::Conditional - Looking up module information / loading at runtime\n\n**Synopsis:** use Module::Load::Conditional qw[canload checkinstall requires];\nmy $uselist = {\nCPANPLUS        => 0.05,\nLWP             => 5.60,\n'Test::More'    => undef,\n};\nprint canload( modules => $uselist )\n? 'all modules loaded successfully'\n: 'failed to load required modules';\nmy $rv = checkinstall( module => 'LWP', version => 5.60 )\nor print 'LWP is not installed!';\nprint 'LWP up to date' if $rv->{uptodate};\nprint \"LWP version is $rv->{version}\\n\";\nprint \"LWP is installed as file $rv->{file}\\n\";\nprint \"LWP requires the following modules to be installed:\\n\";\nprint join \"\\n\", requires('LWP');\n### allow M::L::C to peek in your %INC rather than just\n### scanning @INC\n$Module::Load::Conditional::CHECKINCHASH = 1;\n### reset the 'canload' cache\nundef $Module::Load::Conditional::CACHE;\n### don't have Module::Load::Conditional issue warnings --\n### default is '1'\n$Module::Load::Conditional::VERBOSE = 0;\n### The last error that happened during a call to 'canload'\nmy $err = $Module::Load::Conditional::ERROR;\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (39 lines)\n- **DESCRIPTION** (6 lines)\n- **Methods** (80 lines)\n- **Global Variables** (49 lines)\n- **BUG REPORTS** (2 lines)\n- **AUTHOR** (2 lines)\n- **COPYRIGHT** (3 lines)\n\n## Full Content\n\n### NAME\n\nModule::Load::Conditional - Looking up module information / loading at runtime\n\n### SYNOPSIS\n\nuse Module::Load::Conditional qw[canload checkinstall requires];\n\n\nmy $uselist = {\nCPANPLUS        => 0.05,\nLWP             => 5.60,\n'Test::More'    => undef,\n};\n\nprint canload( modules => $uselist )\n? 'all modules loaded successfully'\n: 'failed to load required modules';\n\n\nmy $rv = checkinstall( module => 'LWP', version => 5.60 )\nor print 'LWP is not installed!';\n\nprint 'LWP up to date' if $rv->{uptodate};\nprint \"LWP version is $rv->{version}\\n\";\nprint \"LWP is installed as file $rv->{file}\\n\";\n\n\nprint \"LWP requires the following modules to be installed:\\n\";\nprint join \"\\n\", requires('LWP');\n\n### allow M::L::C to peek in your %INC rather than just\n### scanning @INC\n$Module::Load::Conditional::CHECKINCHASH = 1;\n\n### reset the 'canload' cache\nundef $Module::Load::Conditional::CACHE;\n\n### don't have Module::Load::Conditional issue warnings --\n### default is '1'\n$Module::Load::Conditional::VERBOSE = 0;\n\n### The last error that happened during a call to 'canload'\nmy $err = $Module::Load::Conditional::ERROR;\n\n### DESCRIPTION\n\nModule::Load::Conditional provides simple ways to query and possibly load any of the modules you\nhave installed on your system during runtime.\n\nIt is able to load multiple modules at once or none at all if one of them was not able to load.\nIt also takes care of any error checking and so forth.\n\n### Methods\n\n$href = checkinstall( module => NAME [, version => VERSION, verbose => BOOL ] );\n\"checkinstall\" allows you to verify if a certain module is installed or not. You may call it\nwith the following arguments:\n\nmodule\nThe name of the module you wish to verify -- this is a required key\n\nversion\nThe version this module needs to be -- this is optional\n\nverbose\nWhether or not to be verbose about what it is doing -- it will default to\n$Module::Load::Conditional::VERBOSE\n\nIt will return undef if it was not able to find where the module was installed, or a hash\nreference with the following keys if it was able to find the file:\n\nfile\nFull path to the file that contains the module\n\ndir Directory, or more exact the @INC entry, where the module was loaded from.\n\nversion\nThe version number of the installed module - this will be \"undef\" if the module had no (or\nunparsable) version number, or if the variable $Module::Load::Conditional::FINDVERSION was\nset to true. (See the \"GLOBAL VARIABLES\" section below for details)\n\nuptodate\nA boolean value indicating whether or not the module was found to be at least the version\nyou specified. If you did not specify a version, uptodate will always be true if the module\nwas found. If no parsable version was found in the module, uptodate will also be true, since\n\"checkinstall\" had no way to verify clearly.\n\nSee also $Module::Load::Conditional::DEPRECATED, which affects the outcome of this value.\n\n$bool = canload( modules => { NAME => VERSION [,NAME => VERSION] }, [verbose => BOOL, nocache => BOOL, autoload => BOOL] )\n\"canload\" will take a list of modules, optionally with version numbers and determine if it is\nable to load them. If it can load *ALL* of them, it will. If one or more are unloadable, none\nwill be loaded.\n\nThis is particularly useful if you have More Than One Way (tm) to solve a problem in a program,\nand only wish to continue down a path if all modules could be loaded, and not load them if they\ncouldn't.\n\nThis function uses the \"load\" function or the \"autoloadremote\" function from Module::Load under\nthe hood.\n\n\"canload\" takes the following arguments:\n\nmodules\nThis is a hashref of module/version pairs. The version indicates the minimum version to\nload. If no version is provided, any version is assumed to be good enough.\n\nverbose\nThis controls whether warnings should be printed if a module failed to load. The default is\nto use the value of $Module::Load::Conditional::VERBOSE.\n\nnocache\n\"canload\" keeps its results in a cache, so it will not load the same module twice, nor will\nit attempt to load a module that has already failed to load before. By default, \"canload\"\nwill check its cache, but you can override that by setting \"nocache\" to true.\n\nautoload\nThis controls whether imports the functions of a loaded modules to the caller package. The\ndefault is no importing any functions.\n\nSee the \"autoload\" function and the \"autoloadremote\" function from Module::Load for\ndetails.\n\n@list = requires( MODULE );\n\"requires\" can tell you what other modules a particular module requires. This is particularly\nuseful when you're intending to write a module for public release and are listing its\nprerequisites.\n\n\"requires\" takes but one argument: the name of a module. It will then first check if it can\nactually load this module, and return undef if it can't. Otherwise, it will return a list of\nmodules and pragmas that would have been loaded on the module's behalf.\n\nNote: The list \"require\" returns has originated from your current perl and your current install.\n\n### Global Variables\n\nThe behaviour of Module::Load::Conditional can be altered by changing the following global\nvariables:\n\n$Module::Load::Conditional::VERBOSE\nThis controls whether Module::Load::Conditional will issue warnings and explanations as to why\ncertain things may have failed. If you set it to 0, Module::Load::Conditional will not output\nany warnings. The default is 0;\n\n$Module::Load::Conditional::FINDVERSION\nThis controls whether Module::Load::Conditional will try to parse (and eval) the version from\nthe module you're trying to load.\n\nIf you don't wish to do this, set this variable to \"false\". Understand then that version\ncomparisons are not possible, and Module::Load::Conditional can not tell you what module version\nyou have installed. This may be desirable from a security or performance point of view. Note\nthat $FINDVERSION code runs safely under \"taint mode\".\n\nThe default is 1;\n\n$Module::Load::Conditional::CHECKINCHASH\nThis controls whether \"Module::Load::Conditional\" checks your %INC hash to see if a module is\navailable. By default, only @INC is scanned to see if a module is physically on your filesystem,\nor available via an \"@INC-hook\". Setting this variable to \"true\" will trust any entries in %INC\nand return them for you.\n\nThe default is 0;\n\n$Module::Load::Conditional::FORCESAFEINC\nThis controls whether \"Module::Load::Conditional\" sanitises @INC by removing \"\".\"\". The current\ndefault setting is 0, but this may change in a future release.\n\n$Module::Load::Conditional::CACHE\nThis holds the cache of the \"canload\" function. If you explicitly want to remove the current\ncache, you can set this variable to \"undef\"\n\n$Module::Load::Conditional::ERROR\nThis holds a string of the last error that happened during a call to \"canload\". It is useful to\ninspect this when \"canload\" returns \"undef\".\n\n$Module::Load::Conditional::DEPRECATED\nThis controls whether \"Module::Load::Conditional\" checks if a dual-life core module has been\ndeprecated. If this is set to true \"checkinstall\" will return false to \"uptodate\", if a\ndual-life module is found to be loaded from $Config{privlibexp}\n\nThe default is 0;\n\nSee Also\n\"Module::Load\"\n\n### BUG REPORTS\n\nPlease report bugs or other issues to <bug-module-load-conditional@rt.cpan.org>.\n\n### AUTHOR\n\nThis module by Jos Boumans <kane@cpan.org>.\n\n### COPYRIGHT\n\nThis library is free software; you may redistribute and/or modify it under the same terms as\nPerl itself.\n\n"
        }
    ],
    "structuredContent": {
        "command": "Module::Load::Conditional",
        "section": "",
        "mode": "perldoc",
        "summary": "Module::Load::Conditional - Looking up module information / loading at runtime",
        "synopsis": "use Module::Load::Conditional qw[canload checkinstall requires];\nmy $uselist = {\nCPANPLUS        => 0.05,\nLWP             => 5.60,\n'Test::More'    => undef,\n};\nprint canload( modules => $uselist )\n? 'all modules loaded successfully'\n: 'failed to load required modules';\nmy $rv = checkinstall( module => 'LWP', version => 5.60 )\nor print 'LWP is not installed!';\nprint 'LWP up to date' if $rv->{uptodate};\nprint \"LWP version is $rv->{version}\\n\";\nprint \"LWP is installed as file $rv->{file}\\n\";\nprint \"LWP requires the following modules to be installed:\\n\";\nprint join \"\\n\", requires('LWP');\n### allow M::L::C to peek in your %INC rather than just\n### scanning @INC\n$Module::Load::Conditional::CHECKINCHASH = 1;\n### reset the 'canload' cache\nundef $Module::Load::Conditional::CACHE;\n### don't have Module::Load::Conditional issue warnings --\n### default is '1'\n$Module::Load::Conditional::VERBOSE = 0;\n### The last error that happened during a call to 'canload'\nmy $err = $Module::Load::Conditional::ERROR;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 39,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "Methods",
                "lines": 80,
                "subsections": []
            },
            {
                "name": "Global Variables",
                "lines": 49,
                "subsections": []
            },
            {
                "name": "BUG REPORTS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}