{
    "content": [
        {
            "type": "text",
            "text": "# TAP::Parser::IteratorFactory (perldoc)\n\n## NAME\n\nTAP::Parser::IteratorFactory - Figures out which SourceHandler objects to use for a given Source\n\n## SYNOPSIS\n\nuse TAP::Parser::IteratorFactory;\nmy $factory = TAP::Parser::IteratorFactory->new({ %config });\nmy $iterator  = $factory->makeiterator( $filename );\n\n## DESCRIPTION\n\nThis is a factory class that takes a TAP::Parser::Source and runs it through all the registered\nTAP::Parser::SourceHandlers to see which one should handle the source.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS** (2 subsections)\n- **SUBCLASSING** (1 subsections)\n- **AUTHORS**\n- **ATTRIBUTION**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "TAP::Parser::IteratorFactory",
        "section": "",
        "mode": "perldoc",
        "summary": "TAP::Parser::IteratorFactory - Figures out which SourceHandler objects to use for a given Source",
        "synopsis": "use TAP::Parser::IteratorFactory;\nmy $factory = TAP::Parser::IteratorFactory->new({ %config });\nmy $iterator  = $factory->makeiterator( $filename );",
        "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": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Class Methods",
                        "lines": 15
                    },
                    {
                        "name": "Instance Methods",
                        "lines": 49
                    }
                ]
            },
            {
                "name": "SUBCLASSING",
                "lines": 2,
                "subsections": [
                    {
                        "name": "Example",
                        "lines": 19
                    }
                ]
            },
            {
                "name": "AUTHORS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "ATTRIBUTION",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "TAP::Parser::IteratorFactory - Figures out which SourceHandler objects to use for a given Source\n",
                "subsections": []
            },
            "VERSION": {
                "content": "Version 3.43\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use TAP::Parser::IteratorFactory;\nmy $factory = TAP::Parser::IteratorFactory->new({ %config });\nmy $iterator  = $factory->makeiterator( $filename );\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This is a factory class that takes a TAP::Parser::Source and runs it through all the registered\nTAP::Parser::SourceHandlers to see which one should handle the source.\n\nIf you're a plugin author, you'll be interested in how to \"registerhandler\"s, how\n\"detectsource\" works.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Class Methods",
                        "content": "\"new\"\nCreates a new factory class:\n\nmy $sf = TAP::Parser::IteratorFactory->new( $config );\n\n$config is optional. If given, sets \"config\" and calls \"loadhandlers\".\n\n\"registerhandler\"\nRegisters a new TAP::Parser::SourceHandler with this factory.\n\nPACKAGE->registerhandler( $handlerclass );\n\n\"handlers\"\nList of handlers that have been registered.\n"
                    },
                    {
                        "name": "Instance Methods",
                        "content": "\"config\"\nmy $cfg = $sf->config;\n$sf->config({ Perl => { %config } });\n\nChaining getter/setter for the configuration of the available source handlers. This is a hashref\nkeyed on handler class whose values contain config to be passed onto the handlers during\ndetection & creation. Class names may be fully qualified or abbreviated, eg:\n\n# these are equivalent\n$sf->config({ 'TAP::Parser::SourceHandler::Perl' => { %config } });\n$sf->config({ 'Perl' => { %config } });\n\n\"loadhandlers\"\n$sf->loadhandlers;\n\nLoads the handler classes defined in \"config\". For example, given a config:\n\n$sf->config({\nMySourceHandler => { some => 'config' },\n});\n\n\"loadhandlers\" will attempt to load the \"MySourceHandler\" class by looking in @INC for it in\nthis order:\n\nTAP::Parser::SourceHandler::MySourceHandler\nMySourceHandler\n\n\"croak\"s on error.\n\n\"makeiterator\"\nmy $iterator = $srcfactory->makeiterator( $source );\n\nGiven a TAP::Parser::Source, finds the most suitable TAP::Parser::SourceHandler to use to create\na TAP::Parser::Iterator (see \"detectsource\"). Dies on error.\n\n\"detectsource\"\nGiven a TAP::Parser::Source, detects what kind of source it is and returns *one*\nTAP::Parser::SourceHandler (the most confident one). Dies on error.\n\nThe detection algorithm works something like this:\n\nfor (@registeredhandlers) {\n# ask them how confident they are about handling this source\n$confidence{$handler} = $handler->canhandle( $source )\n}\n# choose the most confident handler\n\nTies are handled by choosing the first handler.\n"
                    }
                ]
            },
            "SUBCLASSING": {
                "content": "Please see \"SUBCLASSING\" in TAP::Parser for a subclassing overview.\n",
                "subsections": [
                    {
                        "name": "Example",
                        "content": "If we've done things right, you'll probably want to write a new source, rather than sub-classing\nthis (see TAP::Parser::SourceHandler for that).\n\nBut in case you find the need to...\n\npackage MyIteratorFactory;\n\nuse strict;\n\nuse base 'TAP::Parser::IteratorFactory';\n\n# override source detection algorithm\nsub detectsource {\nmy ($self, $rawsourceref, $meta) = @;\n# do detective work, using $meta and whatever else...\n}\n\n1;\n"
                    }
                ]
            },
            "AUTHORS": {
                "content": "Steve Purkis\n",
                "subsections": []
            },
            "ATTRIBUTION": {
                "content": "Originally ripped off from Test::Harness.\n\nMoved out of TAP::Parser & converted to a factory class to support extensible TAP source\ndetective work by Steve Purkis.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "TAP::Object, TAP::Parser, TAP::Parser::SourceHandler, TAP::Parser::SourceHandler::File,\nTAP::Parser::SourceHandler::Perl, TAP::Parser::SourceHandler::RawTAP,\nTAP::Parser::SourceHandler::Handle, TAP::Parser::SourceHandler::Executable\n",
                "subsections": []
            }
        }
    }
}