{
    "mode": "perldoc",
    "parameter": "Devel::GlobalDestruction",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Devel%3A%3AGlobalDestruction/json",
    "generated": "2026-06-11T19:58:55Z",
    "synopsis": "package Foo;\nuse Devel::GlobalDestruction;\nuse namespace::clean; # to avoid having an \"inglobaldestruction\" method\nsub DESTROY {\nreturn if inglobaldestruction;\ndosomethingalittletricky();\n}",
    "sections": {
        "NAME": {
            "content": "Devel::GlobalDestruction - Provides function returning the equivalent of \"${^GLOBALPHASE} eq\n'DESTRUCT'\" for older perls.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "package Foo;\nuse Devel::GlobalDestruction;\n\nuse namespace::clean; # to avoid having an \"inglobaldestruction\" method\n\nsub DESTROY {\nreturn if inglobaldestruction;\n\ndosomethingalittletricky();\n}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Perl's global destruction is a little tricky to deal with WRT finalizers because it's not\nordered and objects can sometimes disappear.\n\nWriting defensive destructors is hard and annoying, and usually if global destruction is\nhappening you only need the destructors that free up non process local resources to actually\nexecute.\n\nFor these constructors you can avoid the mess by simply bailing out if global destruction is in\neffect.\n",
            "subsections": []
        },
        "EXPORTS": {
            "content": "This module uses Sub::Exporter::Progressive so the exports may be renamed, aliased, etc. if\nSub::Exporter is present.\n\ninglobaldestruction\nReturns true if the interpreter is in global destruction. In perl 5.14+, this returns\n\"${^GLOBALPHASE} eq 'DESTRUCT'\", and on earlier perls, detects it using the value of\n\"PLmaincv\" or \"PLdirty\".\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Yuval Kogman <nothingmuch@woobling.org>\n\nFlorian Ragwitz <rafl@debian.org>\n\nJesse Luehrs <doy@tozt.net>\n\nPeter Rabbitson <ribasushi@cpan.org>\n\nArthur Axel 'fREW' Schmidt <frioux@gmail.com>\n\nElizabeth Mattijsen <liz@dijkmat.nl>\n\nGreham Knop <haarg@haarg.org>\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright (c) 2008 Yuval Kogman. All rights reserved\nThis program is free software; you can redistribute\nit and/or modify it under the same terms as Perl itself.\n",
            "subsections": []
        }
    },
    "summary": "Devel::GlobalDestruction - Provides function returning the equivalent of \"${^GLOBALPHASE} eq 'DESTRUCT'\" for older perls.",
    "flags": [],
    "examples": [],
    "see_also": []
}