Devel::GlobalPhase(3)
π Devel::GlobalPhase π
okay bestie, so this is Devel::GlobalPhase, a little Perl module from the User Contributed Perl Documentation section (that's section 3, iykyk). And what it does?? It lets you peek at perl's global phase even on old-ass perls that don't ship the built-in for it. slay.
β¨ NAME β¨
Devel::GlobalPhase β detect perl's global phase on older perls. no cap.
πΈ SYNOPSIS πΈ
use Devel::GlobalPhase;
print global_phase; # RUN
use Devel::GlobalPhase -var;
print ${^GLOBAL_PHASE}; # RUN
like. look at her. two whole lines and she's already doing the most. π
π¦ DESCRIPTION π¦
So here's the tea: this module gives you access to ${^GLOBAL_PHASE} on versions of perl that literally do not provide it. iconic behaviour, honestly. And if the built-in variable is available? Then it just uses that instead. no drama, no duplicating effort, she's efficient like that. β¨
But real talk β if all you actually need is to detect global destruction, then Devel::GlobalDestruction should be used instead of this module. fr fr, don't use the whole toolkit when you need one screwdriver.
π EXPORTS π
global_phase
Returns the global phase β either straight up from "${^GLOBAL_PHASE}", or by calculating it herself if the built-in isn't there. she's resourceful. π
π OPTIONS π
-varβ if you specify this one on import, the global variable"${^GLOBAL_PHASE}"gets created if it doesn't already exist, emulating the built-in variable from newer perls. it's giving "I made this myself". π
π BUGS π
okay so there are some things you should know, and I'm gonna be honest with you because that's what besties do:
- There are tricks that can be played with
BorXSthat would fool this module for theINITandENDphase. so like. if someone's out here doing XS shenanigans, she can be deceived. π - During an
"END {}"block that gets created at runtime after this module is loaded, the phase may be reported as"RUN". And yes, it could be made more accurate β but that would slow the module down significantly during theRUNphase, and it has the potential to segfault perl. so. we do not do that. periodt. π«Ά
bestie if you're out here reading the BUGS section you're already a real one, keep going π
π AUTHOR π
haarg β Graham Knop (cpan:HAARG) <haarg@haarg.org>
π CONTRIBUTORS π
Uses some code taken from Devel::GlobalDestruction. shoutout, we love a collab. π«Ά
β COPYRIGHT β
Copyright (c) 2013 the Devel::GlobalPhase "AUTHOR" and "CONTRIBUTORS" as listed above.
πΈ LICENSE πΈ
This library is free software and may be distributed under the same terms as perl itself. open source queen behaviour, we love to see it. π
and that's the whole page bestie!! this one's from perl v5.42.0, dated 2025-07-25, and it lives in the Devel::GlobalPhase(3) manpage. go forth and detect some phases. mwah. πβ¨
π¦ where this page comes from
- fedora 43: perl-Devel-GlobalPhase 0.003003-23.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms