{
    "mode": "perldoc",
    "parameter": "Test2::Util::Facets2Legacy",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Test2%3A%3AUtil%3A%3AFacets2Legacy/json",
    "generated": "2026-06-10T13:42:55Z",
    "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 Test2::Event). These\nsubroutines can be used as methods on any object that provides a custom \"facetdata()\" method.\nThese subroutines can also be 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 default \"facetdata()\"\nmethod in Test2::Event relies on the legacy methods this module emulates in order to work. As a\nresult of this it is very easy to create infinite recursion bugs.\n\nThese methods have cycle detection and will throw an exception early if a cycle is detected.\n\"uuid()\" is currently the only subroutine in this library that has a fallback behavior when\ncycles are detected.\n",
            "subsections": []
        },
        "EXPORTS": {
            "content": "Nothing is exported by default. You must specify which methods to import, 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 details.\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, if so the exit code is\nreturned (which could be 0). undef is returned 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 detected and an event is used\nas the argument.\n",
            "subsections": []
        },
        "SOURCE": {
            "content": "The source code repository for Test2 can be found at http://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 under the same terms as\nPerl 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": []
}