SPVM::Scope::Guard(3)
π NAME π
okay bestie, welcome to the SPVM::Scope::Guard(3) page from the User Contributed Perl Documentation β and the whole vibe is literally Executing Callback at End of Scope. yes, we're doing cleanup-with-a-callback energy. π
β¨
β¨ USAGE β¨
here's the group-chat demo, no cap:
use Scope::Guard;
# Executing the callback at the end of the scope
{
Scope::Guard->new(method : void () {
print "End of Scope\n";
});
print "Foo";
}
# With field definitions
{
my $value = 1;
Scope::Guard->new([$value : int] method : void () {
print "$value\n";
});
print "Foo";
}
π¦ DESCRIPTION π¦
the Scope::Guard class has the methods to execute a callback at the end of the scope. that's the whole assignment, bestie. π«Ά
πΈ FIELDS πΈ
π· callback π·
has callback : ro Callback;
a callback called at the end of the scope. that's it, that's the field. π
π₯ CLASS METHODS π₯
π«Ά new π«Ά
static method new : Scope::Guard ($callback : Callback);
creates a new Scope::Guard object and returns it. iconic behavior.
$callback is set to the callback field.
Exceptions: $callback must be defined. otherwise an exception is thrown. no cap β undefined callback = exception, so don't try it. π
π§ INSTANCE METHODS π§
π DESTROY π
method DESTROY : void ();
executes the callback. that's the whole method. periodt. π
π SEE ALSO π
Scope::GuardβSPVM::Scope::Guardis a port of Perl'sScope::Guardto SPVM.
π COPYRIGHT & LICENSE π
Copyright (c) 2023 Yuki Kimoto
MIT License
byeee bestie π«Άπ this cutie was rendered from perl v5.42.2, dated 2026-02-03, and it's the SPVM::Scope::Guard(3) page. mwah ππ
π¦ where this page comes from
- alpine 3.24: spvm-doc 0.990125-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms