line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tie::StorableDir::Slot; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
103
|
use 5.008; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
177
|
|
4
|
4
|
|
|
4
|
|
23
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
255
|
|
5
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
142
|
|
6
|
4
|
|
|
4
|
|
3392
|
use Tie::StorableDir::BackedHash; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
242
|
|
7
|
4
|
|
|
4
|
|
3611
|
use Tie::StorableDir::BackedArray; |
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
670
|
|
8
|
4
|
|
|
4
|
|
3733
|
use Tie::StorableDir::BackedScalar; |
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
123
|
|
9
|
4
|
|
|
4
|
|
34
|
use Carp; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
4446
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# This is an internal class, representing one value out of a key/value |
12
|
|
|
|
|
|
|
# entry in the root hash. It is used to write back data to the filesystem |
13
|
|
|
|
|
|
|
# once it has been modified. |
14
|
|
|
|
|
|
|
# Copyright (C) 2005 by Bryan Donlan |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or modify |
17
|
|
|
|
|
|
|
# it under the same terms as Perl itself, either Perl version 5.8.5 or, |
18
|
|
|
|
|
|
|
# at your option, any later version of Perl 5 you may have available. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
18
|
|
|
18
|
0
|
35
|
my ($class, $key, $value, $parent) = @_; |
22
|
18
|
|
33
|
|
|
72
|
$class = ref $class || $class; |
23
|
18
|
|
|
|
|
75
|
my $self = { |
24
|
|
|
|
|
|
|
key => $key, |
25
|
|
|
|
|
|
|
value => $value, |
26
|
|
|
|
|
|
|
parent => $parent, |
27
|
|
|
|
|
|
|
}; |
28
|
18
|
|
|
|
|
47
|
bless $self, $class; |
29
|
18
|
|
|
|
|
46
|
return $self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub getvalue { |
33
|
20
|
|
|
20
|
0
|
82
|
return $_[0]->translate($_[0]->{value}); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub getkey { |
37
|
0
|
|
|
0
|
0
|
0
|
return $_[0]->{key}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub disconnect { |
41
|
19
|
|
|
19
|
0
|
63
|
delete $_[0]->{parent}; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub translate { |
45
|
30
|
|
|
30
|
0
|
45
|
my ($self, $thing) = @_; |
46
|
30
|
|
|
|
|
31
|
my $newthing; |
47
|
30
|
100
|
|
|
|
109
|
return $thing unless ref $thing; |
48
|
20
|
50
|
|
|
|
59
|
return $thing unless $self->{parent}; |
49
|
20
|
100
|
|
|
|
80
|
if (UNIVERSAL::isa($thing, 'HASH')) { |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
50
|
8
|
|
|
|
|
12
|
$newthing = {}; |
51
|
8
|
|
|
|
|
47
|
tie %$newthing, 'Tie::StorableDir::BackedHash', $self, $thing; |
52
|
|
|
|
|
|
|
} elsif (UNIVERSAL::isa($thing, 'ARRAY')) { |
53
|
12
|
|
|
|
|
23
|
$newthing = []; |
54
|
12
|
|
|
|
|
73
|
tie @$newthing, 'Tie::StorableDir::BackedArray', $self, $thing; |
55
|
|
|
|
|
|
|
} elsif (UNIVERSAL::isa($thing, 'SCALAR')) { |
56
|
0
|
|
|
|
|
0
|
my $temp = undef; |
57
|
0
|
|
|
|
|
0
|
$newthing = \$temp; |
58
|
0
|
|
|
|
|
0
|
tie $temp, 'Tie::StorableDir::BackedScalar', $self, $thing; |
59
|
|
|
|
|
|
|
} else { |
60
|
0
|
|
|
|
|
0
|
carp "Can't tie type: ".ref($thing); |
61
|
0
|
|
|
|
|
0
|
$newthing = $thing; |
62
|
|
|
|
|
|
|
} |
63
|
20
|
|
|
|
|
83
|
return $newthing; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub writeback { |
67
|
19
|
|
|
19
|
0
|
32
|
my $self = $_[0]; |
68
|
19
|
100
|
|
|
|
180
|
if (defined $self->{parent}) { |
69
|
17
|
|
|
|
|
67
|
$self->{parent}->STORE($self->{key}, $self->{value}); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub DESTROY { |
74
|
18
|
|
|
18
|
|
391
|
$_[0]->writeback; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |