docs::a...:Global(3)

πŸ“¦ version 2.0.13, in nixos 26.05, nixpkgs unstable

πŸ’… 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_register is 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 $key is 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 $key is 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 says special_list_call in the synopsis line for special_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 $key is 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 πŸ“š

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