{
    "mode": "perldoc",
    "parameter": "Test2::Util::Facets2Legacy",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Test2%3A%3AUtil%3A%3AFacets2Legacy/json",
    "generated": "2026-05-30T16:08:30Z",
    "synopsis": "AS METHODS\npackage My::Event;\nuse Test2::Util::Facets2Legacy ':ALL';\nsub facetdata { return { ... } }\nThen to use it:\nmy $e = My::Event->new(...);\nmy $causesfail = $e->causesfail;\nmy $summary     = $e->summary;\n....\nAS FUNCTIONS\nuse Test2::Util::Facets2Legacy ':ALL';\nmy $f = {\nassert => { ... },\ninfo => [{...}, ...],\ncontrol => {...},\n...\n};\nmy $causesfail = causesfail($f);\nmy $summary     = summary($f);",
    "sections": {
        "NAME": {
            "content": "Test2::Util::Facets2Legacy - Convert facet data to the legacy event API.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module exports several subroutines from the older event API (see\nTest2::Event). These subroutines can be used as methods on any object\nthat provides a custom \"facetdata()\" method. These subroutines can also\nbe used as functions that take a facet data hashref as arguments.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "AS METHODS\npackage My::Event;\n\nuse Test2::Util::Facets2Legacy ':ALL';\n\nsub facetdata { return { ... } }\n\nThen to use it:\n\nmy $e = My::Event->new(...);\n\nmy $causesfail = $e->causesfail;\nmy $summary     = $e->summary;\n....\n\nAS FUNCTIONS\nuse Test2::Util::Facets2Legacy ':ALL';\n\nmy $f = {\nassert => { ... },\ninfo => [{...}, ...],\ncontrol => {...},\n...\n};\n\nmy $causesfail = causesfail($f);\nmy $summary     = summary($f);\n",
            "subsections": []
        },
        "NOTE ON CYCLES": {
            "content": "When used as methods, all these subroutines call \"$e->facetdata()\". The\ndefault \"facetdata()\" method in Test2::Event relies on the legacy\nmethods this module emulates in order to work. As a result of this it is\nvery easy to create infinite recursion bugs.\n\nThese methods have cycle detection and will throw an exception early if\na cycle is detected. \"uuid()\" is currently the only subroutine in this\nlibrary that has a fallback behavior when cycles are detected.\n",
            "subsections": []
        },
        "EXPORTS": {
            "content": "Nothing is exported by default. You must specify which methods to\nimport, or use the ':ALL' tag.\n\n$bool = $e->causesfail()\n$bool = causesfail($f)\nCheck if the event or facets result in a failing state.\n\n$bool = $e->diagnostics()\n$bool = diagnostics($f)\nCheck if the event or facets contain any diagnostics information.\n\n$bool = $e->global()\n$bool = global($f)\nCheck if the event or facets need to be globally processed.\n\n$bool = $e->incrementscount()\n$bool = incrementscount($f)\nCheck if the event or facets make an assertion.\n\n$bool = $e->nodisplay()\n$bool = nodisplay($f)\nCheck if the event or facets should be rendered or hidden.\n\n($max, $directive, $reason) = $e->setsplan()\n($max, $directive, $reason) = setsplan($f)\nCheck if the event or facets set a plan, and return the plan\ndetails.\n\n$id = $e->subtestid()\n$id = subtestid($f)\nGet the subtest id, if any.\n\n$string = $e->summary()\n$string = summary($f)\nGet the summary of the event or facets hash, if any.\n\n$undeforint = $e->terminate()\n$undeforint = terminate($f)\nCheck if the event or facets should result in process termination,\nif so the exit code is returned (which could be 0). undef is\nreturned if no termination is requested.\n\n$uuid = $e->uuid()\n$uuid = uuid($f)\nGet the UUID of the facets or event.\n\nNote: This will fall back to \"$e->SUPER::uuid()\" if a cycle is\ndetected and an event is used as the argument.\n",
            "subsections": []
        },
        "SOURCE": {
            "content": "The source code repository for Test2 can be found at\nhttp://github.com/Test-More/test-more/.\n",
            "subsections": []
        },
        "MAINTAINERS": {
            "content": "Chad Granum <exodist@cpan.org>\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Chad Granum <exodist@cpan.org>\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright 2020 Chad Granum <exodist@cpan.org>.\n\nThis program is free software; you can redistribute it and/or modify it\nunder the same terms as Perl itself.\n\nSee http://dev.perl.org/licenses/\n",
            "subsections": []
        }
    },
    "summary": "Test2::Util::Facets2Legacy - Convert facet data to the legacy event API.",
    "flags": [],
    "examples": [],
    "see_also": []
}