line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tie::IxHash::FixedSize; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
722
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
5
|
1
|
|
|
1
|
|
13
|
use base 'Tie::IxHash'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
720
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.01'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# location of size field in @$self. Tie::IxHash uses 0-3 |
10
|
1
|
|
|
1
|
|
4963
|
use constant SIZE_IX => 4; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
232
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub TIEHASH { |
13
|
1
|
|
|
1
|
|
381
|
my $class = shift; |
14
|
1
|
50
|
|
|
|
6
|
my $conf = shift if ref $_[0] eq 'HASH'; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
50
|
|
|
3
|
$conf ||= {}; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
11
|
my $self = $class->SUPER::TIEHASH(@_); |
19
|
|
|
|
|
|
|
|
20
|
1
|
50
|
|
|
|
6
|
if ($conf->{size}) { |
21
|
1
|
|
|
|
|
2
|
$self->[SIZE_IX] = $conf->{size}; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
4
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub STORE { |
28
|
7
|
|
|
7
|
|
1678
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
7
|
|
|
|
|
23
|
$self->SUPER::STORE(@_); |
31
|
|
|
|
|
|
|
|
32
|
7
|
100
|
|
|
|
78
|
if (my $max_size = $self->[SIZE_IX]) { |
33
|
4
|
|
|
|
|
12
|
while ($self->Keys > $max_size) { |
34
|
4
|
|
|
|
|
30
|
$self->Shift; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |