scope_guard

Lexically-scoped resource management

Version

0.21-2
(2025-12-25)

Size

2.3

KiB

Repository

HaikuPorts
This module provides a convenient way to perform cleanup or other forms of resource management at the end of a scope. It is particularly useful when dealing with exceptions: the Scope::Guard constructor takes a reference to a subroutine that is guaranteed to be called even if the thread of execution is aborted prematurely. This effectively allows lexically-scoped "promises" to be made that are automatically honoured by perl's garbage collector.