{
    "content": [
        {
            "type": "text",
            "text": "# CPAN::Meta::Requirements (perldoc)\n\n## NAME\n\nCPAN::Meta::Requirements - a set of version requirements for a CPAN dist\n\n## SYNOPSIS\n\nuse CPAN::Meta::Requirements;\nmy $buildrequires = CPAN::Meta::Requirements->new;\n$buildrequires->addminimum('Library::Foo' => 1.208);\n$buildrequires->addminimum('Library::Foo' => 2.602);\n$buildrequires->addminimum('Module::Bar'  => 'v1.2.3');\n$METAyml->{buildrequires} = $buildrequires->asstringhash;\n\n## DESCRIPTION\n\nA CPAN::Meta::Requirements object models a set of version constraints like those specified in\nthe META.yml or META.json files in CPAN distributions, and as defined by CPAN::Meta::Spec; It\ncan be built up by adding more and more constraints, and it will reduce them to the simplest\nrepresentation.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS**\n- **SUPPORT** (1 subsections)\n- **AUTHORS**\n- **CONTRIBUTORS**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "CPAN::Meta::Requirements",
        "section": "",
        "mode": "perldoc",
        "summary": "CPAN::Meta::Requirements - a set of version requirements for a CPAN dist",
        "synopsis": "use CPAN::Meta::Requirements;\nmy $buildrequires = CPAN::Meta::Requirements->new;\n$buildrequires->addminimum('Library::Foo' => 1.208);\n$buildrequires->addminimum('Library::Foo' => 2.602);\n$buildrequires->addminimum('Module::Bar'  => 'v1.2.3');\n$METAyml->{buildrequires} = $buildrequires->asstringhash;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 182,
                "subsections": []
            },
            {
                "name": "SUPPORT",
                "lines": 5,
                "subsections": [
                    {
                        "name": "Source Code",
                        "lines": 7
                    }
                ]
            },
            {
                "name": "AUTHORS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "CONTRIBUTORS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "CPAN::Meta::Requirements - a set of version requirements for a CPAN dist\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 2.140\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use CPAN::Meta::Requirements;\n\nmy $buildrequires = CPAN::Meta::Requirements->new;\n\n$buildrequires->addminimum('Library::Foo' => 1.208);\n\n$buildrequires->addminimum('Library::Foo' => 2.602);\n\n$buildrequires->addminimum('Module::Bar'  => 'v1.2.3');\n\n$METAyml->{buildrequires} = $buildrequires->asstringhash;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "A CPAN::Meta::Requirements object models a set of version constraints like those specified in\nthe META.yml or META.json files in CPAN distributions, and as defined by CPAN::Meta::Spec; It\ncan be built up by adding more and more constraints, and it will reduce them to the simplest\nrepresentation.\n\nLogically impossible constraints will be identified immediately by thrown exceptions.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "new\nmy $req = CPAN::Meta::Requirements->new;\n\nThis returns a new CPAN::Meta::Requirements object. It takes an optional hash reference\nargument. Currently, only one key is supported:\n\n*   \"badversionhook\" -- if provided, when a version cannot be parsed into a version object,\nthis code reference will be called with the invalid version string as first argument, and\nthe module name as second argument. It must return a valid version object.\n\nAll other keys are ignored.\n\naddminimum\n$req->addminimum( $module => $version );\n\nThis adds a new minimum version requirement. If the new requirement is redundant to the existing\nspecification, this has no effect.\n\nMinimum requirements are inclusive. $version is required, along with any greater version number.\n\nThis method returns the requirements object.\n\naddmaximum\n$req->addmaximum( $module => $version );\n\nThis adds a new maximum version requirement. If the new requirement is redundant to the existing\nspecification, this has no effect.\n\nMaximum requirements are inclusive. No version strictly greater than the given version is\nallowed.\n\nThis method returns the requirements object.\n\naddexclusion\n$req->addexclusion( $module => $version );\n\nThis adds a new excluded version. For example, you might use these three method calls:\n\n$req->addminimum( $module => '1.00' );\n$req->addmaximum( $module => '1.82' );\n\n$req->addexclusion( $module => '1.75' );\n\nAny version between 1.00 and 1.82 inclusive would be acceptable, except for 1.75.\n\nThis method returns the requirements object.\n\nexactversion\n$req->exactversion( $module => $version );\n\nThis sets the version required for the given module to *exactly* the given version. No other\nversion would be considered acceptable.\n\nThis method returns the requirements object.\n\naddrequirements\n$req->addrequirements( $anotherreqobject );\n\nThis method adds all the requirements in the given CPAN::Meta::Requirements object to the\nrequirements object on which it was called. If there are any conflicts, an exception is thrown.\n\nThis method returns the requirements object.\n\nacceptsmodule\nmy $bool = $req->acceptsmodule($module => $version);\n\nGiven an module and version, this method returns true if the version specification for the\nmodule accepts the provided version. In other words, given:\n\nModule => '>= 1.00, < 2.00'\n\nWe will accept 1.00 and 1.75 but not 0.50 or 2.00.\n\nFor modules that do not appear in the requirements, this method will return true.\n\nclearrequirement\n$req->clearrequirement( $module );\n\nThis removes the requirement for a given module from the object.\n\nThis method returns the requirements object.\n\nrequirementsformodule\n$req->requirementsformodule( $module );\n\nThis returns a string containing the version requirements for a given module in the format\ndescribed in CPAN::Meta::Spec or undef if the given module has no requirements. This should only\nbe used for informational purposes such as error messages and should not be interpreted or used\nfor comparison (see \"acceptsmodule\" instead).\n\nstructuredrequirementsformodule\n$req->structuredrequirementsformodule( $module );\n\nThis returns a data structure containing the version requirements for a given module or undef if\nthe given module has no requirements. This should not be used for version checks (see\n\"acceptsmodule\" instead).\n\nAdded in version 2.134.\n\nrequiredmodules\nThis method returns a list of all the modules for which requirements have been specified.\n\nclone\n$req->clone;\n\nThis method returns a clone of the invocant. The clone and the original object can then be\nchanged independent of one another.\n\nissimple\nThis method returns true if and only if all requirements are inclusive minimums -- that is, if\ntheir string expression is just the version number.\n\nisfinalized\nThis method returns true if the requirements have been finalized by having the \"finalize\" method\ncalled on them.\n\nfinalize\nThis method marks the requirements finalized. Subsequent attempts to change the requirements\nwill be fatal, *if* they would result in a change. If they would not alter the requirements,\nthey have no effect.\n\nIf a finalized set of requirements is cloned, the cloned requirements are not also finalized.\n\nasstringhash\nThis returns a reference to a hash describing the requirements using the strings in the\nCPAN::Meta::Spec specification.\n\nFor example after the following program:\n\nmy $req = CPAN::Meta::Requirements->new;\n\n$req->addminimum('CPAN::Meta::Requirements' => 0.102);\n\n$req->addminimum('Library::Foo' => 1.208);\n\n$req->addmaximum('Library::Foo' => 2.602);\n\n$req->addminimum('Module::Bar'  => 'v1.2.3');\n\n$req->addexclusion('Module::Bar'  => 'v1.2.8');\n\n$req->exactversion('Xyzzy'  => '6.01');\n\nmy $hashref = $req->asstringhash;\n\n$hashref would contain:\n\n{\n'CPAN::Meta::Requirements' => '0.102',\n'Library::Foo' => '>= 1.208, <= 2.206',\n'Module::Bar'  => '>= v1.2.3, != v1.2.8',\n'Xyzzy'        => '== 6.01',\n}\n\naddstringrequirement\n$req->addstringrequirement('Library::Foo' => '>= 1.208, <= 2.206');\n$req->addstringrequirement('Library::Foo' => v1.208);\n\nThis method parses the passed in string and adds the appropriate requirement for the given\nmodule. A version can be a Perl \"v-string\". It understands version ranges as described in the\n\"Version Ranges\" in CPAN::Meta::Spec. For example:\n\n1.3\n>= 1.3\n<= 1.3\n== 1.3\n!= 1.3\n> 1.3\n< 1.3\n>= 1.3, != 1.5, <= 2.0\nA version number without an operator is equivalent to specifying a minimum (\">=\"). Extra\nwhitespace is allowed.\n\nfromstringhash\nmy $req = CPAN::Meta::Requirements->fromstringhash( \\%hash );\nmy $req = CPAN::Meta::Requirements->fromstringhash( \\%hash, \\%opts );\n\nThis is an alternate constructor for a CPAN::Meta::Requirements object. It takes a hash of\nmodule names and version requirement strings and returns a new CPAN::Meta::Requirements object.\nAs with addstringrequirement, a version can be a Perl \"v-string\". Optionally, you can supply a\nhash-reference of options, exactly as with the \"new\" method.\n",
                "subsections": []
            },
            "SUPPORT": {
                "content": "Bugs / Feature Requests\nPlease report any bugs or feature requests through the issue tracker at\n<https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements/issues>. You will be notified\nautomatically of any progress on your issue.\n",
                "subsections": [
                    {
                        "name": "Source Code",
                        "content": "This is open source software. The code repository is available for public review and\ncontribution under the terms of the license.\n\n<https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements>\n\ngit clone https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements.git\n"
                    }
                ]
            },
            "AUTHORS": {
                "content": "*   David Golden <dagolden@cpan.org>\n\n*   Ricardo Signes <rjbs@cpan.org>\n",
                "subsections": []
            },
            "CONTRIBUTORS": {
                "content": "*   Ed J <mohawk2@users.noreply.github.com>\n\n*   Karen Etheridge <ether@cpan.org>\n\n*   Leon Timmermans <fawaka@gmail.com>\n\n*   robario <webmaster@robario.com>\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENSE": {
                "content": "This software is copyright (c) 2010 by David Golden and Ricardo Signes.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
                "subsections": []
            }
        }
    }
}