autodie::Scope::GuardStack - Hook stack for managing scopes via %^H
use autodie::Scope::GuardStack; my $stack = autodie::Scope::GuardStack->new $^H{'my-key'} = $stack; $stack->push_hook(sub {});
Perl Programmers Reference Guide autodie::Scope::GuardStack(3) NAME autodie::Scope::GuardStack - Hook stack for managing scopes via %^H SYNOPSIS use autodie::Scope::GuardStack; my $stack = autodie::Scope::GuardStack->new $^H{'my-key'} = $stack; $stack->push_hook(sub {}); DESCRIPTION This class is a stack of hooks to be called in the right order as scopes go away. The stack is only useful when inserted into "%^H" and will pop hooks as their "scope" is popped. This is 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". 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. ATTRIBUTES See attributes(7) for descriptions of the following attributes: +---------------+-----------------------+ |ATTRIBUTE TYPE | ATTRIBUTE VALUE | +---------------+-----------------------+ |Availability | runtime/perl-532 | +---------------+-----------------------+ |Stability | Pass-through volatile | +---------------+-----------------------+ NOTES Source code for open source software components in Oracle Solaris can be found at https://www.oracle.com/downloads/opensource/solaris-source- code-downloads.html. This software was built from source available at https://github.com/oracle/solaris-userland. The original community source was downloaded from http://www.cpan.org/src/5.0/perl-5.32.0.tar.gz. Further information about this software can be found on the open source community website at https://www.perl.org/. perl v5.32.0 2020-06-14 autodie::Scope::GuardStack(3)