/usr/share/perl5/autodie/Scope/Guard.pm is in libautodie-perl 2.29-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | package autodie::Scope::Guard;
use strict;
use warnings;
# ABSTRACT: Wrapper class for calling subs at end of scope
our $VERSION = '2.29'; # VERSION
# This code schedules the cleanup of subroutines at the end of
# scope. It's directly inspired by chocolateboy's excellent
# Scope::Guard module.
sub new {
my ($class, $handler) = @_;
return bless($handler, $class);
}
sub DESTROY {
my ($self) = @_;
$self->();
}
1;
__END__
=head1 NAME
autodie::Scope::Guard - Wrapper class for calling subs at end of scope
=head1 SYNOPSIS
use autodie::Scope::Guard;
$^H{'my-key'} = autodie::Scope::Guard->new(sub {
print "Hallo world\n";
});
=head1 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.
=head2 Methods
=head3 new
my $hook = autodie::Scope::Guard->new(sub {});
Creates a new C<autodie::Scope::Guard>, which will invoke the given
sub once it goes out of scope (i.e. its DESTROY handler is called).
=head1 AUTHOR
Copyright 2008-2009, Paul Fenwick E<lt>pjf@perltraining.com.auE<gt>
=head1 LICENSE
This module is free software. You may distribute it under the
same terms as Perl itself.
|