{
    "mode": "perldoc",
    "parameter": "TAP::Parser::ResultFactory",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/TAP%3A%3AParser%3A%3AResultFactory/json",
    "generated": "2026-06-09T13:01:44Z",
    "synopsis": "use TAP::Parser::ResultFactory;\nmy $token   = {...};\nmy $factory = TAP::Parser::ResultFactory->new;\nmy $result  = $factory->makeresult( $token );",
    "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": []
        }
    },
    "summary": "TAP::Parser::ResultFactory - Factory for creating TAP::Parser output objects",
    "flags": [],
    "examples": [],
    "see_also": []
}