{
    "content": [
        {
            "type": "text",
            "text": "# CPAN::Distroprefs (perldoc)\n\n## NAME\n\nCPAN::Distroprefs -- read and match distroprefs\n\n## SYNOPSIS\n\nuse CPAN::Distroprefs;\nmy %info = (... distribution/environment info ...);\nmy $finder = CPAN::Distroprefs->find($prefsdir, \\%extmap);\nwhile (my $result = $finder->next) {\ndie $result->asstring if $result->isfatal;\nwarn($result->asstring), next if $result->iswarning;\nfor my $pref (@{ $result->prefs }) {\nif ($pref->matches(\\%info)) {\nreturn $pref;\n}\n}\n}\n\n## DESCRIPTION\n\nThis module encapsulates reading Distroprefs and matching them against CPAN distributions.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **INTERFACE**\n- **RESULTS** (3 subsections)\n- **PREFS**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "CPAN::Distroprefs",
        "section": "",
        "mode": "perldoc",
        "summary": "CPAN::Distroprefs -- read and match distroprefs",
        "synopsis": "use CPAN::Distroprefs;\nmy %info = (... distribution/environment info ...);\nmy $finder = CPAN::Distroprefs->find($prefsdir, \\%extmap);\nwhile (my $result = $finder->next) {\ndie $result->asstring if $result->isfatal;\nwarn($result->asstring), next if $result->iswarning;\nfor my $pref (@{ $result->prefs }) {\nif ($pref->matches(\\%info)) {\nreturn $pref;\n}\n}\n}",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "INTERFACE",
                "lines": 22,
                "subsections": []
            },
            {
                "name": "RESULTS",
                "lines": 3,
                "subsections": [
                    {
                        "name": "Common",
                        "lines": 17
                    },
                    {
                        "name": "Errors",
                        "lines": 5
                    },
                    {
                        "name": "Successes",
                        "lines": 5
                    }
                ]
            },
            {
                "name": "PREFS",
                "lines": 23,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "CPAN::Distroprefs -- read and match distroprefs\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use CPAN::Distroprefs;\n\nmy %info = (... distribution/environment info ...);\n\nmy $finder = CPAN::Distroprefs->find($prefsdir, \\%extmap);\n\nwhile (my $result = $finder->next) {\n\ndie $result->asstring if $result->isfatal;\n\nwarn($result->asstring), next if $result->iswarning;\n\nfor my $pref (@{ $result->prefs }) {\nif ($pref->matches(\\%info)) {\nreturn $pref;\n}\n}\n}\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This module encapsulates reading Distroprefs and matching them against CPAN distributions.\n",
                "subsections": []
            },
            "INTERFACE": {
                "content": "my $finder = CPAN::Distroprefs->find($dir, \\%extmap);\n\nwhile (my $result = $finder->next) { ... }\n\nBuild an iterator which finds distroprefs files in the tree below the given directory. Within\nthe tree directories matching \"m/^[.]/\" are pruned.\n\n%extmap is a hashref whose keys are file extensions and whose values are modules used to load\nmatching files:\n\n{\n'yml' => 'YAML::Syck',\n'dd'  => 'Data::Dumper',\n...\n}\n\nEach time \"$finder->next\" is called, the iterator returns one of two possible values:\n\n*   a CPAN::Distroprefs::Result object\n\n*   \"undef\", indicating that no prefs files remain to be found\n",
                "subsections": []
            },
            "RESULTS": {
                "content": "\"find()\" returns CPAN::Distroprefs::Result objects to indicate success or failure when reading a\nprefs file.\n",
                "subsections": [
                    {
                        "name": "Common",
                        "content": "All results share some common attributes:\n\ntype\n\"success\", \"warning\", or \"fatal\"\n\nfile\nthe file from which these prefs were read, or to which this error refers (relative filename)\n\next\nthe file's extension, which determines how to load it\n\ndir\nthe directory the file was read from\n\nabs\nthe absolute path to the file\n"
                    },
                    {
                        "name": "Errors",
                        "content": "Error results (warning and fatal) contain:\n\nmsg\nthe error message (usually either $! or a YAML error)\n"
                    },
                    {
                        "name": "Successes",
                        "content": "Success results contain:\n\nprefs\nan arrayref of CPAN::Distroprefs::Pref objects\n"
                    }
                ]
            },
            "PREFS": {
                "content": "CPAN::Distroprefs::Pref objects represent individual distroprefs documents. They are constructed\nautomatically as part of \"success\" results from \"find()\".\n\ndata\nthe pref information as a hashref, suitable for e.g. passing to Kwalify\n\nmatchattributes\nreturns a list of the valid match attributes (see the Distroprefs section in CPAN)\n\ncurrently: \"env perl perlconfig distribution module\"\n\nhasanymatch\ntrue if this pref has a 'match' attribute at all\n\nhasvalidsubkeys\ntrue if this pref has a 'match' attribute and at least one valid match attribute\n\nmatches\nif ($pref->matches(\\%arg)) { ... }\n\ntrue if this pref matches the passed-in hashref, which must have a value for each of the\n\"matchattributes\" (above)\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "This program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            }
        }
    }
}