{
    "content": [
        {
            "type": "text",
            "text": "# TAP::Parser::ResultFactory (perldoc)\n\n**Summary:** TAP::Parser::ResultFactory - Factory for creating TAP::Parser output objects\n\n**Synopsis:** use TAP::Parser::ResultFactory;\nmy $token   = {...};\nmy $factory = TAP::Parser::ResultFactory->new;\nmy $result  = $factory->makeresult( $token );\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (5 lines)\n- **VERSION** (9 lines) — 1 subsections\n  - Class Methods (33 lines)\n- **SUBCLASSING** (18 lines) — 1 subsections\n  - Example (15 lines)\n- **SEE ALSO** (2 lines)\n\n## Full Content\n\n### NAME\n\nTAP::Parser::ResultFactory - Factory for creating TAP::Parser output objects\n\n### SYNOPSIS\n\nuse TAP::Parser::ResultFactory;\nmy $token   = {...};\nmy $factory = TAP::Parser::ResultFactory->new;\nmy $result  = $factory->makeresult( $token );\n\n### VERSION\n\nVersion 3.43\n\nDESCRIPTION\nThis is a simple factory class which returns a TAP::Parser::Result subclass representing the\ncurrent bit of test data from TAP (usually a single line). It is used primarily by\nTAP::Parser::Grammar. Unless you're subclassing, you probably won't need to use this module\ndirectly.\n\nMETHODS\n\n#### Class Methods\n\n\"new\"\nCreates a new factory class. *Note:* You currently don't need to instantiate a factory in order\nto use it.\n\n\"makeresult\"\nReturns an instance the appropriate class for the test token passed in.\n\nmy $result = TAP::Parser::ResultFactory->makeresult($token);\n\nCan also be called as an instance method.\n\n\"classfor\"\nTakes one argument: $type. Returns the class for this $type, or \"croak\"s with an error.\n\n\"registertype\"\nTakes two arguments: $type, $class\n\nThis lets you override an existing type with your own custom type, or register a completely new\ntype, eg:\n\n# create a custom result type:\npackage MyResult;\nuse strict;\nuse base 'TAP::Parser::Result';\n\n# register with the factory:\nTAP::Parser::ResultFactory->registertype( 'mytype' => PACKAGE );\n\n# use it:\nmy $r = TAP::Parser::ResultFactory->( { type => 'mytype' } );\n\nYour custom type should then be picked up automatically by the TAP::Parser.\n\n### SUBCLASSING\n\nPlease see \"SUBCLASSING\" in TAP::Parser for a subclassing overview.\n\nThere are a few things to bear in mind when creating your own \"ResultFactory\":\n\n1   The factory itself is never instantiated (this *may* change in the future). This means that\n\"initialize\" is never called.\n\n2   \"TAP::Parser::Result->new\" is never called, $tokens are reblessed. This *will* change in a\nfuture version!\n\n3   TAP::Parser::Result subclasses will register themselves with TAP::Parser::ResultFactory\ndirectly:\n\npackage MyFooResult;\nTAP::Parser::ResultFactory->registertype( foo => PACKAGE );\n\nOf course, it's up to you to decide whether or not to ignore them.\n\n#### Example\n\npackage MyResultFactory;\n\nuse strict;\n\nuse MyResult;\n\nuse base 'TAP::Parser::ResultFactory';\n\n# force all results to be 'MyResult'\nsub classfor {\nreturn 'MyResult';\n}\n\n1;\n\n### SEE ALSO\n\nTAP::Parser, TAP::Parser::Result, TAP::Parser::Grammar\n\n"
        }
    ],
    "structuredContent": {
        "command": "TAP::Parser::ResultFactory",
        "section": "",
        "mode": "perldoc",
        "summary": "TAP::Parser::ResultFactory - Factory for creating TAP::Parser output objects",
        "synopsis": "use TAP::Parser::ResultFactory;\nmy $token   = {...};\nmy $factory = TAP::Parser::ResultFactory->new;\nmy $result  = $factory->makeresult( $token );",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 9,
                "subsections": [
                    {
                        "name": "Class Methods",
                        "lines": 33
                    }
                ]
            },
            {
                "name": "SUBCLASSING",
                "lines": 18,
                "subsections": [
                    {
                        "name": "Example",
                        "lines": 15
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "TAP::Parser::ResultFactory - Factory for creating TAP::Parser output objects\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use TAP::Parser::ResultFactory;\nmy $token   = {...};\nmy $factory = TAP::Parser::ResultFactory->new;\nmy $result  = $factory->makeresult( $token );\n",
                "subsections": []
            },
            "VERSION": {
                "content": "Version 3.43\n\nDESCRIPTION\nThis is a simple factory class which returns a TAP::Parser::Result subclass representing the\ncurrent bit of test data from TAP (usually a single line). It is used primarily by\nTAP::Parser::Grammar. Unless you're subclassing, you probably won't need to use this module\ndirectly.\n\nMETHODS",
                "subsections": [
                    {
                        "name": "Class Methods",
                        "content": "\"new\"\nCreates a new factory class. *Note:* You currently don't need to instantiate a factory in order\nto use it.\n\n\"makeresult\"\nReturns an instance the appropriate class for the test token passed in.\n\nmy $result = TAP::Parser::ResultFactory->makeresult($token);\n\nCan also be called as an instance method.\n\n\"classfor\"\nTakes one argument: $type. Returns the class for this $type, or \"croak\"s with an error.\n\n\"registertype\"\nTakes two arguments: $type, $class\n\nThis lets you override an existing type with your own custom type, or register a completely new\ntype, eg:\n\n# create a custom result type:\npackage MyResult;\nuse strict;\nuse base 'TAP::Parser::Result';\n\n# register with the factory:\nTAP::Parser::ResultFactory->registertype( 'mytype' => PACKAGE );\n\n# use it:\nmy $r = TAP::Parser::ResultFactory->( { type => 'mytype' } );\n\nYour custom type should then be picked up automatically by the TAP::Parser.\n"
                    }
                ]
            },
            "SUBCLASSING": {
                "content": "Please see \"SUBCLASSING\" in TAP::Parser for a subclassing overview.\n\nThere are a few things to bear in mind when creating your own \"ResultFactory\":\n\n1   The factory itself is never instantiated (this *may* change in the future). This means that\n\"initialize\" is never called.\n\n2   \"TAP::Parser::Result->new\" is never called, $tokens are reblessed. This *will* change in a\nfuture version!\n\n3   TAP::Parser::Result subclasses will register themselves with TAP::Parser::ResultFactory\ndirectly:\n\npackage MyFooResult;\nTAP::Parser::ResultFactory->registertype( foo => PACKAGE );\n\nOf course, it's up to you to decide whether or not to ignore them.\n",
                "subsections": [
                    {
                        "name": "Example",
                        "content": "package MyResultFactory;\n\nuse strict;\n\nuse MyResult;\n\nuse base 'TAP::Parser::ResultFactory';\n\n# force all results to be 'MyResult'\nsub classfor {\nreturn 'MyResult';\n}\n\n1;\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "TAP::Parser, TAP::Parser::Result, TAP::Parser::Grammar\n",
                "subsections": []
            }
        }
    }
}