]> Sergey Matveev's repositories - public-inbox.git/commit
on_destroy: generic localized END
authorEric Wong <e@80x24.org>
Thu, 17 Dec 2020 10:45:12 +0000 (10:45 +0000)
committerEric Wong <e@80x24.org>
Sat, 19 Dec 2020 09:32:08 +0000 (09:32 +0000)
commit7e7f4bfca5f2ef0d123445e074280f5e65cdfb85
tree591d12f8dce7c43a5fac167b10481bcaa83b2f03
parent68fea5b055787c65f0e7164cbd5463f140382ea9
on_destroy: generic localized END

This is a localized version of the process-wide END{}, but runs
at the end of variable scope.  A subroutine ref and arguments
may be passed, which allows us to avoid anonymous subs and
problems they cause.

It's similar to `defer' or `ensure' in other languages; Perl can
rely on deterministic destructors due to refcounting.
MANIFEST
lib/PublicInbox/OnDestroy.pm [new file with mode: 0644]
t/on_destroy.t [new file with mode: 0644]