autodie::Scope::Guard(3p)

autodie::Scope::Guard3p

Wrapper class for calling subs at end of scope

Usage

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

Overview

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.

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).

Releases

21 releases since OpenBSD 6.1; the text changed 14 times.

  1. 6.1
  2. 6.2
  3. 6.3–6.4
  4. 6.5
  5. 6.6
  6. 6.7
  7. 6.8
  8. 6.9–7.2
  9. 7.3
  10. 7.4
  11. 7.5
  12. 7.6
  13. 7.7–7.8
  14. 7.9
  15. 8.0

Author

Copyright 2008-2009, Paul Fenwick <[email protected]>

License

This module is free software. You may distribute it under the same terms as Perl itself.

From man 8.0-current-20261101 in OpenBSD 8.0-current (2026-11-01). Parsed by carta from the page's man source.