line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ref::Store::Feature::KeyTyped; |
2
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
4
|
|
|
|
|
|
|
our $AUTOLOAD; |
5
|
1
|
|
|
1
|
|
7
|
use Log::Fu; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
16
|
|
6
|
1
|
|
|
1
|
|
55
|
use Carp qw(confess); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
7
|
1
|
|
|
1
|
|
5
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
8
|
1
|
|
|
1
|
|
5
|
use Ref::Store::Common; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
264
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$SIG{__DIE__} = \&confess; |
11
|
|
|
|
|
|
|
BEGIN { |
12
|
1
|
|
|
1
|
|
3
|
foreach my $fname (qw( |
13
|
|
|
|
|
|
|
store |
14
|
|
|
|
|
|
|
fetch |
15
|
|
|
|
|
|
|
purgeby |
16
|
|
|
|
|
|
|
unlink |
17
|
|
|
|
|
|
|
lexists |
18
|
|
|
|
|
|
|
)) { |
19
|
5
|
|
|
|
|
11
|
my $wrapname = $fname . "_kt"; |
20
|
|
|
|
|
|
|
{ |
21
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
296
|
|
|
5
|
|
|
|
|
6
|
|
22
|
5
|
|
|
|
|
125
|
*{$wrapname} = sub { |
23
|
2
|
|
|
2
|
|
73
|
my @args = @_; |
24
|
2
|
|
|
|
|
5
|
my $self = $args[0]; |
25
|
2
|
|
|
|
|
6
|
my ($ktarg) = splice(@args, 2, 1); |
26
|
2
|
|
|
|
|
17
|
my $pfix = $self->get_kt_prefix($ktarg, "$fname: Can't find prefix ($ktarg)!"); |
27
|
2
|
|
|
|
|
5
|
my $orig = $args[1]; |
28
|
2
|
50
|
|
|
|
6
|
die "Must have defined key!" unless defined $orig; |
29
|
2
|
50
|
|
|
|
7
|
if(!ref $orig) { |
30
|
2
|
|
|
|
|
7
|
$orig = $pfix . HR_PREFIX_DELIM . $orig; |
31
|
2
|
|
|
|
|
3
|
$args[1] = $orig; |
32
|
|
|
|
|
|
|
} else { |
33
|
0
|
|
|
|
|
0
|
log_warn("Using keytypes with object key has no effect"); |
34
|
|
|
|
|
|
|
} |
35
|
2
|
|
|
|
|
4
|
shift @args; |
36
|
2
|
|
|
|
|
21
|
return $self->$fname(@args); |
37
|
5
|
|
|
|
|
26
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub get_kt_prefix { |
43
|
2
|
|
|
2
|
0
|
103
|
my ($self,$kt,$do_die) = @_; |
44
|
2
|
|
|
|
|
8
|
my $ret = $self->keytypes->{$kt}; |
45
|
2
|
50
|
33
|
|
|
10
|
if((!$ret) && $do_die) { |
46
|
0
|
|
|
|
|
0
|
die $do_die; |
47
|
|
|
|
|
|
|
} |
48
|
2
|
|
|
|
|
5
|
return $ret; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
1; |