| 1 | ;# $Id | ||
| 2 | ;# | ||
| 3 | ;# @COPYRIGHT@ | ||
| 4 | ;# | ||
| 5 | ;# $Log: Lock.pm,v $ | ||
| 6 | ;# Revision 0.3 2007/09/28 19:20:14 jv | ||
| 7 | ;# Track where lock was issued in the code. | ||
| 8 | ;# | ||
| 9 | ;# Revision 0.2.1.1 2000/01/04 21:16:28 ram | ||
| 10 | ;# patch1: track where lock was issued in the code | ||
| 11 | ;# | ||
| 12 | ;# Revision 0.2 1999/12/07 20:51:04 ram | ||
| 13 | ;# Baseline for 0.2 release. | ||
| 14 | ;# | ||
| 15 | |||
| 16 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | ######################################################################## | ||
| 19 | package LockFile::Lock; | ||
| 20 | |||
| 21 | # | ||
| 22 | # A lock instance -- deferred class. | ||
| 23 | # | ||
| 24 | |||
| 25 | # | ||
| 26 | # ->_lock_init | ||
| 27 | # | ||
| 28 | # Common lock initialization | ||
| 29 | # | ||
| 30 | # Attributes: | ||
| 31 | # | ||
| 32 | # scheme the LockFile::* object that created the lock | ||
| 33 | # filename where lock was taken | ||
| 34 | # line line in filename where lock was taken | ||
| 35 | # | ||
| 36 | 4 | ▶ | sub _lock_init { |
|
Subroutine
_lock_init: called CC=1 SCAR=0.0
| |||
| 37 | 4 | my $self = shift; | |
| 38 | 4 | my ($scheme, $filename, $line) = @_; | |
| 39 | 4 | $self->{'scheme'} = $scheme; | |
| 40 | 4 | $self->{'filename'} = $filename; | |
| 41 | 4 | $self->{'line'} = $line; | |
| 42 | } | ||
| 43 | |||
| 44 | # | ||
| 45 | # Common attribute access | ||
| 46 | # | ||
| 47 | |||
| 48 | 1 | ▶ | sub scheme { $_[0]->{'scheme'} } |
|
Subroutine
scheme: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 49 | 3 | ▶ | sub filename { $_[0]->{'filename'} } |
|
Subroutine
filename: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 50 | 3 | ▶ | sub line { $_[0]->{'line'} } |
|
Subroutine
line: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 51 | |||
| 52 | # | ||
| 53 | # ->release | ||
| 54 | # | ||
| 55 | # Release the lock | ||
| 56 | # | ||
| 57 | 1 | ▶ | sub release { |
|
Subroutine
release: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 58 | 1 | my $self = shift; | |
| 59 | 1 | return $self->scheme->release($self); | |
| 60 | } | ||
| 61 | |||
| 62 | # | ||
| 63 | # ->where | ||
| 64 | # | ||
| 65 | # Returns '"filename", line #' where lock was taken. | ||
| 66 | # | ||
| 67 | 3 | ▶ | sub where { |
|
Subroutine
where: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 68 | 3 | my $self = shift; | |
| 69 | 3 | return sprintf '"%s", line %d', $self->filename, $self->line; | |
| 70 | } | ||
| 71 | |||
| 72 | 4 | 1; | |
| 73 | |||