{
    "content": [
        {
            "type": "text",
            "text": "# CPAN::Meta::Requirements (info)\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\nlike those specified in the META.yml or META.json files in CPAN\ndistributions, and as defined by CPAN::Meta::Spec; It can be built up\nby adding more and more constraints, and it will reduce them to the\nsimplest representation.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS**\n- **SUPPORT**\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": "info",
        "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": 3,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 197,
                "subsections": []
            },
            {
                "name": "SUPPORT",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "CONTRIBUTORS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "CPAN::Meta::Requirements - a set of version requirements for a CPAN\ndist\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\nlike those specified in the META.yml or META.json files in CPAN\ndistributions, and as defined by CPAN::Meta::Spec; It can be built up\nby adding more and more constraints, and it will reduce them to the\nsimplest representation.\n\nLogically impossible constraints will be identified immediately by\nthrown exceptions.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "new\nmy $req = CPAN::Meta::Requirements->new;\n\nThis returns a new CPAN::Meta::Requirements object.  It takes an\noptional hash reference argument.  Currently, only one key is\nsupported:\n\no   \"badversionhook\" -- if provided, when a version cannot be parsed\ninto a version object, this code reference will be called with the\ninvalid version string as first argument, and the module name as\nsecond 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\nredundant to the existing specification, this has no effect.\n\nMinimum requirements are inclusive.  $version is required, along with\nany 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\nredundant to the existing specification, this has no effect.\n\nMaximum requirements are inclusive.  No version strictly greater than\nthe given version is allowed.\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\nthree 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\nfor 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\ngiven version.  No other version 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\nCPAN::Meta::Requirements object to the requirements object on which it\nwas 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\nspecification for the module accepts the provided version.  In other\nwords, 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\nreturn 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\nmodule in the format described in CPAN::Meta::Spec or undef if the\ngiven module has no requirements. This should only be used for\ninformational purposes such as error messages and should not be\ninterpreted or used for comparison (see \"acceptsmodule\" instead).\n\nstructuredrequirementsformodule\n$req->structuredrequirementsformodule( $module );\n\nThis returns a data structure containing the version requirements for a\ngiven module or undef if the given module has no requirements.  This\nshould not be used for version checks (see \"acceptsmodule\" instead).\n\nAdded in version 2.134.\n\nrequiredmodules\nThis method returns a list of all the modules for which requirements\nhave been specified.\n\nclone\n$req->clone;\n\nThis method returns a clone of the invocant.  The clone and the\noriginal object can then be changed independent of one another.\n\nissimple\nThis method returns true if and only if all requirements are inclusive\nminimums -- that is, if their string expression is just the version\nnumber.\n\nisfinalized\nThis method returns true if the requirements have been finalized by\nhaving the \"finalize\" method called on them.\n\nfinalize\nThis method marks the requirements finalized.  Subsequent attempts to\nchange the requirements will be fatal, if they would result in a\nchange.  If they would not alter the requirements, they have no effect.\n\nIf a finalized set of requirements is cloned, the cloned requirements\nare not also finalized.\n\nasstringhash\nThis returns a reference to a hash describing the requirements using\nthe strings in the CPAN::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\nrequirement for the given module.  A version can be a Perl \"v-string\".\nIt understands version ranges as described in the \"Version Ranges\" in\nCPAN::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\nminimum (\">=\").  Extra whitespace 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.\nIt takes a hash of module names and version requirement strings and\nreturns a new CPAN::Meta::Requirements object. As with\naddstringrequirement, a version can be a Perl \"v-string\". Optionally,\nyou can supply a hash-reference of options, exactly as with the \"new\"\nmethod.\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>.\nYou will be notified automatically of any progress on your issue.\n\nSource Code\nThis is open source software.  The code repository is available for\npublic review and contribution 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",
                "subsections": []
            },
            "AUTHORS": {
                "content": "o   David Golden <dagolden@cpan.org>\n\no   Ricardo Signes <rjbs@cpan.org>\n",
                "subsections": []
            },
            "CONTRIBUTORS": {
                "content": "o   Ed J <mohawk2@users.noreply.github.com>\n\no   Karen Etheridge <ether@cpan.org>\n\no   Leon Timmermans <fawaka@gmail.com>\n\no   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\nthe same terms as the Perl 5 programming language system itself.\n\nperl v5.34.0                      2026-06-23   CPAN::Meta::Requirements(3perl)",
                "subsections": []
            }
        }
    }
}