autodie...rdStack(3pm)
πΈ NAME πΈ
autodie::Scope::GuardStack β Hook stack for managing scopes via %^H. Bestie, you're in the autodie...rdStack(3pm) manual, part of the Perl Programmers Reference Guide. Slay. β¨
π SYNOPSIS π
use autodie::Scope::GuardStack;
my $stack = autodie::Scope::GuardStack->new
$^H{'my-key'} = $stack;
$stack->push_hook(sub {});
π¦ DESCRIPTION π¦
Okay so this class is a stack of hooks that get called in the right order as scopes go away. The stack is only useful when inserted into %^H, and it will pop hooks as their "scope" is popped. That is literally so useful for uninstalling or reinstalling subs in a namespace as a pragma goes out of scope. π
Due to how %^H works, this class is only useful during the compilation phase of a perl module and relies on the internals of how perl handles references in %^H. Also, important vibe check: this module is not a part of autodie's public API. π«Ά
π Methods π
π new π
my $stack = autodie::Scope::GuardStack->new;
Creates a new autodie::Scope::GuardStack. The stack is initially empty and must be inserted into %^H by the creator. β¨
π push_hook π
$stack->push_hook(sub {});
Add a sub to the stack. The sub will be called once the current compile-time "scope" is left. Multiple hooks can be added per scope. π₯
π AUTHOR π
Copyright 2013, Niels Thykier <niels@thykier.net> π«Ά
π LICENSE π
This module is free software. You may distribute it under the same terms as Perl itself. π
xoxo, bestie β this page is from perl v5.42.3, dated 2026-11-03, and it lives under the autodie...rdStack(3pm) manual. slay. π
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms