NAME

File::Information::Lock - generic module for extracting information from filesystems

VERSION

version v0.04

SYNOPSIS

use File::Information;

my File::Information::Lock $lock = $obj->lock;

This package is used to represent locks on resources and objects.

The lock is hold until the last reference to the object is gone.

METHODS

new

my File::Information::Lock $lock = File::Information::Lock->new([ instance => $instance, ] parent => $parent, on_unlock => \&unlock_sub);

Returns a new lock object. Requires an instance (File::Information), a parent object (what is locked), and an unlock function. If no instance is given $parent->instance is called to obtain one.

Once this lock is gone the unlock function is called. It is normally a private method of the object that is locked. The unlock function is responsible of handling the case with multiple lock objects being alive at the same time. So any unlock function must check if all locks are gone before performing an actual unlock. The unlock function is called on $parent and passing the lock as first argument.

instance

my File::Information $instance = $lock->instance;

Returns the instance that was used to create this object.

parent

my $parent = $lock->parent;

Returns the parent that was used to create this object.

AUTHOR

Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2024 by Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)