line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
16
|
|
|
16
|
|
98
|
|
|
16
|
|
|
|
|
37
|
|
|
16
|
|
|
|
|
96
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
16
|
|
|
16
|
|
98
|
use Catmandu::Hits; |
|
16
|
|
|
|
|
31
|
|
|
16
|
|
|
|
|
84
|
|
8
|
16
|
|
|
16
|
|
10833
|
use Clone qw(clone); |
|
16
|
|
|
|
|
46
|
|
|
16
|
|
|
|
|
606
|
|
9
|
16
|
|
|
16
|
|
129
|
use namespace::clean; |
|
16
|
|
|
|
|
28
|
|
|
16
|
|
|
|
|
833
|
|
10
|
16
|
|
|
16
|
|
92
|
|
|
16
|
|
|
|
|
42
|
|
|
16
|
|
|
|
|
73
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::Bag'; |
12
|
|
|
|
|
|
|
with 'Catmandu::Droppable'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has _hash => |
15
|
|
|
|
|
|
|
(is => 'rw', lazy => 1, init_arg => undef, builder => '_build_hash'); |
16
|
|
|
|
|
|
|
has _head => (is => 'rw', init_arg => undef, clearer => '_clear_head'); |
17
|
|
|
|
|
|
|
has _tail => (is => 'rw', init_arg => undef, clearer => '_clear_tail'); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $self = $_[0]; |
20
|
|
|
|
|
|
|
$self->store->_hashes->{$self->name} ||= {}; |
21
|
27
|
|
|
27
|
|
228
|
} |
22
|
27
|
|
50
|
|
|
407
|
|
23
|
|
|
|
|
|
|
my $self = $_[0]; |
24
|
|
|
|
|
|
|
sub { |
25
|
|
|
|
|
|
|
state $node = $self->_head; |
26
|
26
|
|
|
26
|
0
|
44
|
state $data; |
27
|
|
|
|
|
|
|
$node || return; |
28
|
50
|
|
|
50
|
|
97
|
$data = $node->[1]; |
29
|
50
|
|
|
|
|
59
|
$node = $node->[2]; |
30
|
50
|
100
|
|
|
|
108
|
$data; |
31
|
33
|
|
|
|
|
50
|
}; |
32
|
33
|
|
|
|
|
42
|
} |
33
|
33
|
|
|
|
|
120
|
|
34
|
26
|
|
|
|
|
128
|
my ($self, $id) = @_; |
35
|
|
|
|
|
|
|
my $node = $self->_hash->{$id} || return; |
36
|
|
|
|
|
|
|
clone($node->[1]); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my ($self, $data) = @_; |
40
|
|
|
|
|
|
|
my $id = $data->{$self->id_key}; |
41
|
|
|
|
|
|
|
my $node = $self->_hash->{$id}; |
42
|
|
|
|
|
|
|
if ($node) { |
43
|
|
|
|
|
|
|
$node->[1] = clone($data); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
elsif (my $tail = $self->_tail) { |
46
|
|
|
|
|
|
|
$tail->[2] = $node = [$tail, clone($data), undef]; |
47
|
|
|
|
|
|
|
$self->_hash->{$id} = $node; |
48
|
|
|
|
|
|
|
$self->_tail($node); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
else { |
51
|
|
|
|
|
|
|
$node = [undef, clone($data), undef]; |
52
|
|
|
|
|
|
|
$self->_hash->{$id} = $node; |
53
|
|
|
|
|
|
|
$self->_head($node); |
54
|
|
|
|
|
|
|
$self->_tail($node); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
$data; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my ($self, $id) = @_; |
60
|
|
|
|
|
|
|
my $node = $self->_hash->{$id} || return; |
61
|
|
|
|
|
|
|
if ($node->[0]) { |
62
|
|
|
|
|
|
|
$node->[0][2] = $node->[2]; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
else { |
65
|
|
|
|
|
|
|
$self->_head($node->[2]); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
if ($node->[2]) { |
68
|
|
|
|
|
|
|
$node->[2][0] = $node->[0]; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else { |
71
|
|
|
|
|
|
|
$self->_tail($node->[0]); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
delete $self->_hash->{$id}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $self = $_[0]; |
77
|
|
|
|
|
|
|
$self->_clear_head; |
78
|
|
|
|
|
|
|
$self->_clear_tail; |
79
|
|
|
|
|
|
|
$self->_hash($self->store->_hashes->{$self->name} = {}); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
$_[0]->delete_all; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=pod |
89
|
|
|
|
|
|
|
|
90
|
3
|
|
|
3
|
0
|
168
|
=head1 NAME |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Catmandu::Store::Hash::Bag - Bag implementation for the Hash store |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |