AUTODIE::SCOPE::GUARD(3pm)
π NAME π
autodie::Scope::Guard β a wrapper class for calling subs at end of scope. Yep, the title is autodie::Scope::Guard(3pm), and this page is from the Perl Programmers Reference Guide β hiii bestie π
β¨ SYNOPSIS β¨
okay so the whole point is you use it like this:
use autodie::Scope::Guard;
$^H{'my-key'} = autodie::Scope::Guard->new(sub {
print "Hallo world\n";
});
No cap, that's the vibe π
π¦ DESCRIPTION π¦
So this class is used to bless perl subs so that they are invoked when they are destroyed. Mostly this is useful for ensuring the code is invoked at end of scope. Real talk though: this module is not a part of autodie's public API, periodt π«Ά
This module is directly inspired by chocolateboy's excellent Scope::Guard module. Obsessed, honestly π
π Methods π
π new π
my $hook = autodie::Scope::Guard->new(sub {});
Creates a new autodie::Scope::Guard, which will invoke the given sub once it goes out of scope (i.e. its DESTROY handler is called). Slay β¨
π AUTHOR π
Copyright 2008-2009, Paul Fenwick <pjf@perltraining.com.au> β iconic author behavior π
π LICENSE π
This module is free software. You may distribute it under the same terms as Perl itself π
cute lil' sign-off: this page is from perl v5.42.3, dated 2026-11-03, and the footer tag situation is autodie...e::Guard(3pm) πΈπ¦
π¦ 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