| 1 | # Copyright (c) 2024-2026 Philipp Schafft <lion@cpan.org> | ||||||||||
| 2 | |||||||||||
| 3 | # licensed under Artistic License 2.0 (see LICENSE file) | ||||||||||
| 4 | |||||||||||
| 5 | # ABSTRACT: generic module for extracting information from filesystems | ||||||||||
| 6 | |||||||||||
| 7 | |||||||||||
| 8 | package File::Information::Lock; | ||||||||||
| 9 | |||||||||||
| 10 | 3 | ▶ | use v5.10; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 3 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 3 | our $VERSION = v0.17; | |||||||||
| 17 | |||||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||
| 20 | 0 | my ($pkg, %opts) = @_; | |||||||||
| 21 | 0 | my $self = bless \%opts, $pkg; | |||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | $self->{instance} = $self->{parent}->instance unless defined $self->{instance}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | croak 'No instance is given' unless defined $self->{instance}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | ▶ | croak 'No parent is given' unless defined $self->{parent}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | ▶ | croak 'No on_unlock is given' unless defined $self->{on_unlock}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | |||||||||||
| 29 | 0 | return $self; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | |||||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | sub instance { | ||||||||
|
Subroutine
instance: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 35 | 0 | my ($self) = @_; | |||||||||
| 36 | 0 | return $self->{instance}; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | sub parent { | ||||||||
|
Subroutine
parent: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 41 | 0 | my ($self) = @_; | |||||||||
| 42 | 0 | return $self->{parent}; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | # ---------------- | ||||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | sub DESTROY { | ||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=6.9
| |||||||||||
| 48 | 0 | my ($self) = @_; | |||||||||
| 49 | 0 | my $func = $self->{on_unlock}; | |||||||||
| 50 | 0 | $self->parent->$func($self); | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 3 | 1; | |||||||||
| 54 | |||||||||||
| 55 | __END__ | ||||||||||