| 1 | package Ref::Store::Feature::KeyTyped; | ||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | our $AUTOLOAD; | |||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Log::Fu; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Carp qw(confess); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Ref::Store::Common; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 2 | $SIG{__DIE__} = \&confess; | |||||||||||||||||||||||||||
| 11 | 2 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 12 | 2 | foreach my $fname (qw( | |||||||||||||||||||||||||||
| 13 | store | ||||||||||||||||||||||||||||
| 14 | fetch | ||||||||||||||||||||||||||||
| 15 | purgeby | ||||||||||||||||||||||||||||
| 16 | unlink | ||||||||||||||||||||||||||||
| 17 | lexists | ||||||||||||||||||||||||||||
| 18 | )) { | ||||||||||||||||||||||||||||
| 19 | 10 | my $wrapname = $fname . "_kt"; | |||||||||||||||||||||||||||
| 20 | { | ||||||||||||||||||||||||||||
| 21 | 2 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 10 | ▶ | *{$wrapname} = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||
| 23 | 2 | my @args = @_; | |||||||||||||||||||||||||||
| 24 | 2 | my $self = $args[0]; | |||||||||||||||||||||||||||
| 25 | 2 | my ($ktarg) = splice(@args, 2, 1); | |||||||||||||||||||||||||||
| 26 | 2 | my $pfix = $self->get_kt_prefix($ktarg, "$fname: Can't find prefix ($ktarg)!"); | |||||||||||||||||||||||||||
| 27 | 2 | my $orig = $args[1]; | |||||||||||||||||||||||||||
| 28 | 2 | ▶ | die "Must have defined key!" unless defined $orig; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 2 | ▶ | if(!ref $orig) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 2 | $orig = $pfix . HR_PREFIX_DELIM . $orig; | |||||||||||||||||||||||||||
| 31 | 2 | $args[1] = $orig; | |||||||||||||||||||||||||||
| 32 | } else { | ||||||||||||||||||||||||||||
| 33 | 0 | log_warn("Using keytypes with object key has no effect"); | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | 2 | shift @args; | |||||||||||||||||||||||||||
| 36 | 2 | return $self->$fname(@args); | |||||||||||||||||||||||||||
| 37 | 10 | }; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 2 | ▶ | sub get_kt_prefix { | ||||||||||||||||||||||||||
|
Subroutine
get_kt_prefix: called CC=3 SCAR=12.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | 2 | my ($self,$kt,$do_die) = @_; | |||||||||||||||||||||||||||
| 44 | 2 | my $ret = $self->keytypes->{$kt}; | |||||||||||||||||||||||||||
| 45 | 2 | ▶ | if((!$ret) && $do_die) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $ret and $do_die
MC/DC0%0/2
not $ret and $do_die
not $ret
$do_die
Truth table33%1/3
not(A) and B
A= not $retB= $do_die
| |||||||||||||||||||||||||||||
| 46 | 0 | die $do_die; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | 2 | return $ret; | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | 2 | 1; | |||||||||||||||||||||||||||