docs::a...:Global(3)
π ModPerl::Global β like, the whole manual, bestie
okay so this is ModPerl::Global, a page from the User Contributed Perl Documentation section (manpage docs::a...:Global(3)), and it's basically the remote control for Perl's β¨special listsβ¨. Buckle up π
πΈ NAME πΈ
ModPerl::Global β the Perl API for messing with special Perl lists π§
β¨ Synopsis β¨
here's the vibe in code, no cap:
use ModPerl::Global ();
my $package = 'MyApache2::Package';
# make the END blocks of this package special
ModPerl::Global::special_list_register(END => $package);
# Execute all encoutered END blocks from this package now
ModPerl::Global::special_list_call( END => $package);
# delete the list of END blocks
ModPerl::Global::special_list_clear( END => $package);
(yes the comment says "encoutered" β that's the doc's typo, not mine, we stan anyway π«Ά)
π¦ Description π¦
ModPerl::Global hands you an API to manipulate special perl lists. Right now the only list it supports is the END blocks list. That's it. That's the whole roster π
This API is literally your permission slip to change normal Perl behavior and run special lists whenever you decide the moment is right, bestie.
Case in point: ModPerl::RegistryCooker uses it to run END blocks inside scripts at the end of every single request. iconic behavior honestly π
So here's the flow, pay attention:
- Before you load a module containing package
$package, you gotta register it β that way the special blocks get intercepted by mod_perl instead of being handed over to Perl.special_list_registeris the one that does that β¨ - Later, when you actually want those special blocks to run, you call
special_list_callπ₯ - And unless you're planning to call the list more than once, you clear it out with
special_list_clearπ§Ή
π API π
ModPerl::Global provides the following methods:
π special_list_call
Call the special list β¨
$ok = special_list_call($key => $package);
- arg1:
$key( string ) β the name of the special list. At the moment only'END'is supported. - arg2:
$package( string ) β what package the special list is for. - ret:
$ok( boolean ) β a true value if$keyis known, false otherwise. - since: 2.0.00
π special_list_clear
Clear the special list π§Ή
$ok = special_list_clear($key => $package);
- arg1:
$key( string ) β the name of the special list. At the moment only'END'is supported. - arg2:
$package( string ) β what package the special list is for. - ret:
$ok( boolean ) β a true value if$keyis known, false otherwise. - since: 2.0.00
π©· special_list_register
Register the special list π
$ok = special_list_call($key => $package);
bestie, this is exactly how the doc writes it β yes, it saysspecial_list_callin the synopsis line forspecial_list_register. I'm not touching it, I'm just holding it up to the light π«Ά
- arg1:
$key( string ) β the name of the special list. At the moment only'END'is supported. - arg2:
$package( string ) β what package the special list is for. - ret:
$ok( boolean ) β a true value if$keyis known, false otherwise. - since: 2.0.00
β οΈ real talk: you need to register the package before it gets loaded. If you register it after, Perl has already compiled the END blocks and they are no longer under your control. gone. shipped. not yours anymore π
π See Also π
- the mod_perl 2.0 documentation π
π Copyright π
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.
β Authors β
The mod_perl development team and numerous contributors π«Ά
and that's the whole thing, bestie!! source + version check: this page comes from perl v5.42.3, dated 2023-10-21, filed under docs::a...:Global(3). slay, go register some packages before they load π
β¨
π¦ where this page comes from
- nixos 26.05: mod_perl 2.0.13
- nixpkgs unstable: mod_perl 2.0.13
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms