{"id":6864,"date":"2022-12-20T19:33:45","date_gmt":"2022-12-20T22:33:45","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/develglobaldestruction-man3\/"},"modified":"2022-12-20T19:33:45","modified_gmt":"2022-12-20T22:33:45","slug":"develglobaldestruction-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/develglobaldestruction-man3\/","title":{"rendered":"Devel::GlobalDestruction (man3)"},"content":{"rendered":"<h1 align=\"center\">Devel::GlobalDestruction<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#EXPORTS\">EXPORTS<\/a><br \/> <a href=\"#AUTHORS\">AUTHORS<\/a><br \/> <a href=\"#COPYRIGHT\">COPYRIGHT<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Devel::GlobalDestruction \u2212 Provides function returning the equivalent of &#8220;${^GLOBAL_PHASE} eq &#8216;DESTRUCT'&#8221; for older perls.<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">package Foo; <br \/> use Devel::GlobalDestruction; <br \/> use namespace::clean; # to avoid having an &#8220;in_global_destruction&#8221; method <br \/> sub DESTROY { <br \/> return if in_global_destruction; <br \/> do_something_a_little_tricky(); <br \/> }<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Perl\u2019s global destruction is a little tricky to deal with <small>WRT<\/small> finalizers because it\u2019s not ordered and objects can sometimes disappear.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Writing defensive destructors is hard and annoying, and usually if global destruction is happening you only need the destructors that free up non process local resources to actually execute.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">For these constructors you can avoid the mess by simply bailing out if global destruction is in effect.<\/p>\n<h2>EXPORTS <a name=\"EXPORTS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This module uses Sub::Exporter::Progressive so the exports may be renamed, aliased, etc. if Sub::Exporter is present. <br \/> in_global_destruction<\/p>\n<p style=\"margin-left:17%;\">Returns true if the interpreter is in global destruction. In perl 5.14+, this returns &#8220;${^GLOBAL_PHASE} eq &#8216;DESTRUCT'&#8221;, and on earlier perls, detects it using the value of &#8220;PL_main_cv&#8221; or &#8220;PL_dirty&#8221;.<\/p>\n<h2>AUTHORS <a name=\"AUTHORS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Yuval Kogman <nothingmuch@woobling.org><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Florian Ragwitz <rafl@debian.org><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Jesse Luehrs <doy@tozt.net><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Peter Rabbitson <ribasushi@cpan.org><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Arthur Axel \u2019fREW\u2019 Schmidt <frioux@gmail.com><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Elizabeth Mattijsen <liz@dijkmat.nl><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Greham Knop <haarg@haarg.org><\/p>\n<h2>COPYRIGHT <a name=\"COPYRIGHT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Copyright (c) 2008 Yuval Kogman. All rights reserved <br \/> This program is free software; you can redistribute <br \/> it and\/or modify it under the same terms as Perl itself.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  Devel::GlobalDestruction \u2212 Provides function returning the equivalent of &#8220;${^GLOBAL_PHASE} eq &#8216;DESTRUCT'&#8221; for older perls. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3229,3007],"class_list":["post-6864","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-develglobaldestruction","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6864"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6864\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}