This file is indexed.

/usr/share/perl5/KiokuDB/LiveObjects/Scope.pm is in libkiokudb-perl 0.57-1.

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
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package KiokuDB::LiveObjects::Scope;
BEGIN {
  $KiokuDB::LiveObjects::Scope::AUTHORITY = 'cpan:NUFFIN';
}
$KiokuDB::LiveObjects::Scope::VERSION = '0.57';
use Moose;
# ABSTRACT: Scope helper object

use namespace::clean -except => 'meta';

has objects => (
    traits => [qw(Array)],
    isa => "ArrayRef",
    default => sub { [] },
    clearer => "_clear_objects",
    handles => {
        push => "push",
        objects => "elements",
        clear => "clear",
    },
);

has parent => (
    isa => __PACKAGE__,
    is  => "ro",
);

has live_objects => (
    isa => "KiokuDB::LiveObjects",
    is  => "ro",
    clearer => "_clear_live_objects",
);

sub DEMOLISH {
    my $self = shift;

    # consider possibilities of optimizing live object set removal at this
    # point

    # problems can arise from an object outliving the scope it was loaded in:
    # { my $outer = lookup(...); { my $inner = lookup(...); $outer->foo($inner) } }

    $self->remove;
}

sub detach {
    my $self = shift;

    if ( my $l = $self->live_objects ) {
        $l->detach_scope($self);
    }
}

sub remove {
    my $self = shift;

    if ( my $l = $self->live_objects ) { # can be false under global destruction
        $l->remove_scope($self);
        $self->_clear_live_objects;
    }
}

__PACKAGE__->meta->make_immutable;

__PACKAGE__

__END__

=pod

=encoding UTF-8

=head1 NAME

KiokuDB::LiveObjects::Scope - Scope helper object

=head1 VERSION

version 0.57

=head1 SYNOPSIS

    {
        my $scope = $dir->new_scope;

        ... do work on $dir ...
    }

=head1 DESCRIPTION

Live object scopes exist in order to ensure objects don't die too soon if the
only other references to them are weak.

When scopes are destroyed the refcounts of the objects they refer to go down,
and the parent scope is replaced in the live object set.

=head1 METHODS

=over 4

=item push

Adds objects or entries, increasing their reference count.

=item clear

Clears the objects from the scope object.

=item detach

Marks this scope as no longer the "current" live object scope, if it is the current one.

This allows keeping branching of scopes, which can be useful under long running
applications.

=item remove

Effectively kills the scope by clearing it and removing it from the live object set.

=back

=head1 AUTHOR

Yuval Kogman <nothingmuch@woobling.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Yuval Kogman, Infinity Interactive.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut