logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

autodie::Scope::Guard - Wrapper class for calling subs at end of scope

Author

Copyright 2008-2009, Paul Fenwick <pjf@perltraining.com.au>

Description

This class is used to bless perl subs so that they are invoked when they are destroyed. This is mostly useful for ensuring the code is invoked at end of scope. This module is not a part of autodie's public API. This module is directly inspired by chocolateboy's excellent Scope::Guard module. Methodsnew 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).

License

This module is free software. You may distribute it under the same terms as Perl itself. perl v5.40.1 2025-07-03 autodie::Scope::Guard(3perl)

Name

autodie::Scope::Guard - Wrapper class for calling subs at end of scope

Synopsis

use autodie::Scope::Guard; $^H{'my-key'} = autodie::Scope::Guard->new(sub { print "Hallo world\n"; });

See Also