| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::DAV::LockManager::Simple; |
|
2
|
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
37170
|
use Net::DAV::Lock; |
|
|
14
|
|
|
|
|
28
|
|
|
|
14
|
|
|
|
|
359
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
14
|
|
|
14
|
|
85
|
use strict; |
|
|
14
|
|
|
|
|
24
|
|
|
|
14
|
|
|
|
|
6864
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.305'; |
|
8
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
# This reference implementation of the lock management database interface |
|
12
|
|
|
|
|
|
|
# provides an example of the simplest case of a pluggable lock management |
|
13
|
|
|
|
|
|
|
# backend mechanism which can be swapped in for any other sort of |
|
14
|
|
|
|
|
|
|
# implementation without concern for the operation of the lock manager |
|
15
|
|
|
|
|
|
|
# itself. |
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# |
|
19
|
|
|
|
|
|
|
# Create a new lock manager context. Optionally accepts an array |
|
20
|
|
|
|
|
|
|
# containing a default set of locks. |
|
21
|
|
|
|
|
|
|
# |
|
22
|
|
|
|
|
|
|
sub new { |
|
23
|
58
|
|
|
58
|
0
|
29255
|
my $class = shift; |
|
24
|
|
|
|
|
|
|
|
|
25
|
58
|
|
|
|
|
484
|
return bless \@_, $class; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# |
|
29
|
|
|
|
|
|
|
# Stub method. Simply present to adhere to the lock management interface |
|
30
|
|
|
|
|
|
|
# used within this package. |
|
31
|
|
|
|
|
|
|
# |
|
32
|
|
|
|
|
|
|
sub close { |
|
33
|
2
|
|
|
2
|
0
|
508
|
return; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# |
|
37
|
|
|
|
|
|
|
# Given a normalized string representation of a resource path, return |
|
38
|
|
|
|
|
|
|
# the first lock found. Otherwise, return undef if none is located. |
|
39
|
|
|
|
|
|
|
# |
|
40
|
|
|
|
|
|
|
sub get { |
|
41
|
357
|
|
|
357
|
0
|
1650
|
my ($self, $path) = @_; |
|
42
|
|
|
|
|
|
|
|
|
43
|
357
|
|
|
|
|
620
|
foreach my $lock (@$self) { |
|
44
|
243
|
100
|
|
|
|
584
|
if ($lock->path eq $path) { |
|
45
|
73
|
|
|
|
|
197
|
return $lock; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
284
|
|
|
|
|
637
|
return undef; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# |
|
53
|
|
|
|
|
|
|
# Given a path string, return all objects indexed whose path is a descendant |
|
54
|
|
|
|
|
|
|
# of the one specified. |
|
55
|
|
|
|
|
|
|
# |
|
56
|
|
|
|
|
|
|
sub list_descendants { |
|
57
|
54
|
|
|
54
|
0
|
894
|
my ($self, $path) = @_; |
|
58
|
|
|
|
|
|
|
|
|
59
|
54
|
100
|
|
|
|
172
|
return grep { $_->path ne '/' } @$self if $path eq '/'; |
|
|
5
|
|
|
|
|
11
|
|
|
60
|
46
|
|
|
|
|
144
|
return grep { index($_->path, "$path/") == 0 } @$self; |
|
|
27
|
|
|
|
|
79
|
|
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# |
|
64
|
|
|
|
|
|
|
# Given a Net::DAV::Lock object, replace any other locks whose |
|
65
|
|
|
|
|
|
|
# path corresponds to that which is stored in the list. |
|
66
|
|
|
|
|
|
|
# |
|
67
|
|
|
|
|
|
|
sub update { |
|
68
|
4
|
|
|
4
|
0
|
8
|
my ($self, $lock) = @_; |
|
69
|
|
|
|
|
|
|
|
|
70
|
4
|
|
|
|
|
20
|
for (my $i=0; $$self[$i]; $i++) { |
|
71
|
7
|
100
|
|
|
|
27
|
if ($$self[$i]->path eq $lock->path) { |
|
72
|
4
|
|
|
|
|
16
|
$$self[$i] = $lock; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
4
|
|
|
|
|
16
|
return $lock; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# |
|
80
|
|
|
|
|
|
|
# Add the given lock object to the list. |
|
81
|
|
|
|
|
|
|
# |
|
82
|
|
|
|
|
|
|
sub add { |
|
83
|
58
|
|
|
58
|
0
|
85
|
my ($self, $lock) = @_; |
|
84
|
|
|
|
|
|
|
|
|
85
|
58
|
|
|
|
|
119
|
push @$self, $lock; |
|
86
|
|
|
|
|
|
|
|
|
87
|
58
|
|
|
|
|
296
|
return $lock; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# |
|
91
|
|
|
|
|
|
|
# Given a lock, the database record which contains the corresponding |
|
92
|
|
|
|
|
|
|
# path will be removed. |
|
93
|
|
|
|
|
|
|
# |
|
94
|
|
|
|
|
|
|
sub remove { |
|
95
|
4
|
|
|
4
|
0
|
10
|
my ($self, $lock) = @_; |
|
96
|
|
|
|
|
|
|
|
|
97
|
4
|
|
|
|
|
8
|
@{$self} = grep { $_->path ne $lock->path } @{$self}; |
|
|
4
|
|
|
|
|
15
|
|
|
|
9
|
|
|
|
|
28
|
|
|
|
4
|
|
|
|
|
11
|
|
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |