blib/lib/Tie/Autotie.pm

filter: Statementstmt 94.2% 33 / 35 Branchbran 62.5% 5 / 8 Conditioncond 38.4% 5 / 13 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 70.8% 51 / 72 CC 10 SCAR 19.8
CC
10
Cov
77%
__ANON__
13.5
import
3.2
BEGIN
1.0
CRAP 7.2
↑ Summary
1 package Tie::Autotie;
2  
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = 0.03;
8  
9  
10 1 ▶sub import {
Subroutine import: called CC=3 SCAR=11.6
11 1 my ($class, $pkg, $use_args, $tie_args) = @_;
12  
13 1 ▶ $use_args ||= [];
Condition50%1/2
$use_args ||= []
l!l
01
MC/DC0%0/1
$use_args ||= []
$use_args
Truth table50%1/2
A
A= $use_args
Aresult
11
00
14 1 ▶ $tie_args ||= [];
Condition50%1/2
$tie_args ||= []
l!l
01
MC/DC0%0/1
$tie_args ||= []
$tie_args
Truth table50%1/2
A
A= $tie_args
Aresult
11
00
15  
16 1 ▶ eval "use $pkg \@\$use_args; 1;";
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 *{$pkg . "::AUTOTIE_STORE"} = \&{$pkg . "::STORE"};
22 1 ▶ *{$pkg . "::STORE"} = sub {
Subroutine __ANON__: called CC=8 SCAR=26.0
23 16 my ($self, $key, $value) = @_;
24  
25 16 ▶ if (ref $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $value) 5 11 16
26 5 ▶ if (UNIVERSAL::isa($value, 'SCALAR') and $pkg->can('TIESCALAR')) {
Branch: 3 branches
BranchTrueFalseTotal
if (UNIVERSAL::isa($value, 'SCALAR') and $pkg->can('TIESCALAR')) { } 0 5 5
elsif (UNIVERSAL::isa($value, 'ARRAY') and $pkg->can('TIEARRAY')) { } 0 5 5
elsif (UNIVERSAL::isa($value, 'HASH') and $pkg->can('TIEHASH')) { } 5 0 5
Condition33%1/3
UNIVERSAL::isa($value, "SCALAR") and $pkg->can("TIESCALAR")
!ll&&!rl&&r
500
MC/DC0%0/2
UNIVERSAL::isa($value, "SCALAR") and $pkg->can("TIESCALAR")
UNIVERSAL::isa($value, "SCALAR") $pkg->can("TIESCALAR")
Truth table33%1/3
A and B
A= UNIVERSAL::isa($value, "SCALAR")B= $pkg->can("TIESCALAR")
ABresult
0X0
100
111
27 0 tie $$value, $pkg, @$tie_args;
28 }
29 ▶ elsif (UNIVERSAL::isa($value, 'ARRAY') and $pkg->can('TIEARRAY')) {
Condition33%1/3
UNIVERSAL::isa($value, "ARRAY") and $pkg->can("TIEARRAY")
!ll&&!rl&&r
500
MC/DC0%0/2
UNIVERSAL::isa($value, "ARRAY") and $pkg->can("TIEARRAY")
UNIVERSAL::isa($value, "ARRAY") $pkg->can("TIEARRAY")
Truth table33%1/3
A and B
A= UNIVERSAL::isa($value, "ARRAY")B= $pkg->can("TIEARRAY")
ABresult
0X0
100
111
30 0 tie @$value, $pkg, @$tie_args;
31 }
32 ▶ elsif (UNIVERSAL::isa($value, 'HASH') and $pkg->can('TIEHASH')) {
Condition33%1/3
UNIVERSAL::isa($value, "HASH") and $pkg->can("TIEHASH")
!ll&&!rl&&r
005
MC/DC0%0/2
UNIVERSAL::isa($value, "HASH") and $pkg->can("TIEHASH")
UNIVERSAL::isa($value, "HASH") $pkg->can("TIEHASH")
Truth table33%1/3
A and B
A= UNIVERSAL::isa($value, "HASH")B= $pkg->can("TIEHASH")
ABresult
0X0
100
111
33 5 tie %$value, $pkg, @$tie_args;
34 }
35 }
36  
37 16 $self->AUTOTIE_STORE($key, $value);
38 1 };
39 }
40
41  
42 1 1;
43  
44 __END__
↑ Summary