Devel::GlobalPhase(3)

πŸ“¦
version 0.003003 Β· 2 versions
, in fedora 43

πŸ’– 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 B or XS that would fool this module for the INIT and END phase. 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 the RUN phase, 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 (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