libapa...:Global(3pm)

πŸ’– NAME πŸ’–

ModPerl::Global β€” bestie, it's the Perl API for manipulating special Perl lists ✨


✨ SYNOPSIS ✨

okay so here's the whole vibe in code form, 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);

🌸 DESCRIPTION 🌸

So ModPerl::Global hands you an API to mess with special perl lists, and rn the only list it's obsessed with is the "END" blocks list. That's it. That's the whole roster. πŸ’…

The way this works is that it lets you switch up normal Perl behavior and run those special lists whenever you decide it's time, which is honestly so main character of you.

Example time: ModPerl::RegistryCooker uses it to run "END" blocks inside scripts at the end of every single request. Iconic behavior, ate.

Here's the part you gotta hear tho 🫢 β€” before you load a module that contains the package $package, you need to register it, so those special blocks get intercepted by mod_perl instead of being handed straight to Perl. That interception job belongs to special_list_register. Then, later on, when you're ready to actually execute those special blocks, you call special_list_call. And unless you're planning to call that list more than once, clear it out with special_list_clear. Boom, clean.


πŸ‘‘ API πŸ‘‘

ModPerl::Global provides the following methods β€” collect them all:

πŸ“ special_list_call

Call the special list, bestie. Just do it.

$ok = special_list_call($key => $package);
  • arg1: $key ( string ) β€” the name of the special list. rn only 'END' is supported, that's the only one on the guest list.
  • arg2: $package ( string ) β€” what package the special list is for
  • ret: $ok ( boolean ) β€” a true value if $key is known, false otherwise. so like, a vibe check on your key basically.
  • since: 2.0.00

🧚 special_list_clear

Clear the special list. Wipe it. Fresh start energy ✨

$ok = special_list_clear($key => $package);
  • arg1: $key ( string ) β€” the name of the special list. rn only 'END' is supported.
  • arg2: $package ( string ) β€” what package the special list is for
  • ret: $ok ( boolean ) β€” a true value if $key is known, false otherwise.
  • since: 2.0.00

πŸ¦‹ special_list_register

Register the special list. Sign it up. Put it on the list πŸ“

$ok = special_list_call($key => $package);
  • arg1: $key ( string ) β€” the name of the special list. rn only 'END' is supported.
  • arg2: $package ( string ) β€” what package the special list is for
  • ret: $ok ( boolean ) β€” a true value if $key is known, false otherwise.
  • since: 2.0.00
⚠️ okay this is the important part, don't skip it: you need to register the package before it is loaded. If you register it after, Perl has already compiled the "END" blocks and they are no longer under your control. no takebacks, no redo, it's giving too late πŸ’€

🫢 SEE ALSO 🫢

  • mod_perl 2.0 documentation. that's the one, go read it πŸ‘‘

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. absolute legends, every single one 🌈


and that's the page bestie!! this was perl v5.42.3, dated 2026-08-20, filed under libapa...:Global(3pm) in the User Contributed Perl Documentation corner of the world. slay, go register your package before you load it, mwah πŸ’‹

πŸ“¦ where this page comes from