Rex::Hook(3pm)

πŸ’– Rex::Hook πŸ’–

okay bestie, so Rex::Hook is literally the module that manages all the hooks for various Rex functions. yeah. that's the whole vibe. she's the group chat admin of hooks. πŸ‘‘


✨ DESCRIPTION ✨

This module manages hooks of various Rex functions. fr fr, that's it β€” it's the hook management module. when a Rex function goes through its little journey, Rex::Hook is the one holding the clipboard going "okay who's supposed to run at this point". πŸ’…


🌸 SYNOPSIS 🌸

use Rex::Hook;

register_function_hooks { $state => { $function => $coderef, }, };

yes that is genuinely it. four lines of loml energy. 🌈


πŸŽ€ EXPORTED FUNCTIONS πŸŽ€

πŸ’œ register_function_hooks { $state => { $function => $coderef } };

This one registers a $coderef that gets called when $function reaches $state during its execution. so like β€” the function is out there doing its thing, and the moment it hits that $state, your little $coderef gets summoned. iconic behaviour honestly. ✨

For example:

register_function_hooks { before_change => { file => \&backup } };

see how it reads?? before_change state, file function, \&backup coderef. slay.

ngl, a heads up bestie: $coderef may get parameters passed to it depending on the hook in question. so like. it depends. πŸ™ˆ Each hook is different, so check the given hook's documentation about the details β€” do NOT just assume. iykyk.

and that's the whole page, bestie 🫢 go register some hooks and have a beautiful day.

sign-off: this little cutie lives in perl v5.40.1, dated 2025-10-03, and you can find her filed under Rex::Hook(3pm). periodt. πŸ’…πŸ’–

πŸ“¦ where this page comes from