DWH_File/Value/Factory.pm

filter: Statementstmt 87.5% 56 / 64 Branchbran 73.5% 25 / 34 Conditioncond 44.4% 4 / 9 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 2 totaltotal 77.7% 98 / 126 CC 22 SCAR 28.3
CC
22
Cov
79%
from_input
27.8
from_stored
4.6
BEGIN
1.0
CRAP 16.9
↑ Summary DWH_File/Tie/Array.pm »
1 package DWH_File::Value::Factory;
2  
3 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use vars qw( @ISA $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 9 ▶use UNIVERSAL;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 9 ▶use DWH_File::Value::Plain;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 9 ▶use DWH_File::Value::Undef;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 9 ▶use DWH_File::Tie::Scalar;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 9 ▶use DWH_File::Tie::Array;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 9 ▶use DWH_File::Tie::Hash;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 9 ▶use DWH_File::Tie::Foreign;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 9 @ISA = qw( );
17 9 $VERSION = 0.01;
18  
19 707 ▶sub from_input {
Subroutine from_input: called CC=19 SCAR=33.3
Pod undocumented
20 707 my ( $this, $kernel, $actual, $tier ) = @_;
21 0 ▶ unless ( defined $actual ) { return DWH_File::Value::Undef->new }
Branch: 2 branches
BranchTrueFalseTotal
if (defined $actual) { } 707 0 707
if (do { ref $actual }) { } 31 676 707
22 elsif ( ref $actual ) {
23 31 my $ty;
24 31 ▶ if ( UNIVERSAL::isa( $actual, 'DWH_File::Aware' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::isa($actual, "DWH_File::Aware")) 0 31 31
25 0 ▶ $tier ||= $actual->dwh_tier;
Condition0%0/3
$tier ||= $actual->dwh_tier
l!l&&r!l&&!r
000
MC/DC0%0/2
$tier ||= $actual->dwh_tier
$tier $actual->dwh_tier
Truth table0%0/3
A ||= B
A= $tierB= $actual->dwh_tier
ABresult
1X1
011
000
26 }
27 31 ▶ if ( UNIVERSAL::isa( $actual, 'SCALAR' ) ) {
Branch: 3 branches
BranchTrueFalseTotal
if (UNIVERSAL::isa($actual, 'SCALAR')) { } 2 29 31
elsif (UNIVERSAL::isa($actual, 'ARRAY')) { } 16 13 29
elsif (UNIVERSAL::isa($actual, 'HASH')) { } 13 0 13
28 2 ▶ $ty = tied $$actual or $tier ||= 'DWH_File::Tie::Scalar';
Branch: 1 branch
BranchTrueFalseTotal
$ty = tied $$actual or $tier ||= "DWH_File::Tie::Scalar" 1 1 2
Condition50%1/2
$tier ||= "DWH_File::Tie::Scalar"
l!l
01
MC/DC0%0/1
$tier ||= "DWH_File::Tie::Scalar"
$tier
Truth table50%1/2
A
A= $tier
Aresult
11
00
29 }
30 elsif ( UNIVERSAL::isa( $actual, 'ARRAY' ) ) {
31 16 ▶ $ty = tied @$actual or $tier ||= 'DWH_File::Tie::Array';
Branch: 1 branch
BranchTrueFalseTotal
$ty = tied @$actual or $tier ||= "DWH_File::Tie::Array" 2 14 16
Condition50%1/2
$tier ||= "DWH_File::Tie::Array"
l!l
014
MC/DC0%0/1
$tier ||= "DWH_File::Tie::Array"
$tier
Truth table50%1/2
A
A= $tier
Aresult
11
00
32 }
33 elsif ( UNIVERSAL::isa( $actual, 'HASH' ) ) {
34 13 ▶ $ty = tied %$actual or $tier ||= 'DWH_File::Tie::Hash'
Branch: 1 branch
BranchTrueFalseTotal
$ty = tied %$actual or $tier ||= "DWH_File::Tie::Hash" 0 13 13
Condition100%2/2
$tier ||= "DWH_File::Tie::Hash"
l!l
49
MC/DC100%1/1
$tier ||= "DWH_File::Tie::Hash"
$tier
Truth table100%2/2
A
A= $tier
Aresult
11
00
35 }
36 0 else { die "Unable to tie $actual" }
37 31 ▶ if ( $ty ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ty) { } 3 28 31
38 3 ▶ if ( $ty->isa( 'DWH_File::Tie' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ty->isa('DWH_File::Tie')) { } 3 0 3
39 3 ▶ if ( $ty->{ kernel } == $kernel ) { return $ty }
Branch: 1 branch
BranchTrueFalseTotal
if ($ty->{'kernel'} == $kernel) { } 1 2 3
40 2 else { return DWH_File::Tie::Foreign->new( $kernel, $ty ) }
41 }
42 0 else { die "Can't handle tied data" }
43 }
44 else {
45 28 ▶ if ( UNIVERSAL::isa( $actual, 'DWH_File::Aware' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::isa($actual, "DWH_File::Aware")) 0 28 28
46 0 $actual->dwh_pre_sign_in;
47 }
48 28 $ty = $tier->tie_reference( $kernel, $actual );
49 28 ▶ if ( UNIVERSAL::isa( $actual, 'DWH_File::Aware' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::isa($actual, "DWH_File::Aware")) 0 28 28
50 0 $actual->dwh_post_sign_in( $ty );
51 }
52 28 $kernel->ground_reference( $ty );
53 28 return $ty;
54 }
55 }
56 676 else { return DWH_File::Value::Plain->from_input( $actual ) }
57 }
58  
59 1478 ▶sub from_stored {
Subroutine from_stored: called CC=4 SCAR=15.2
Pod undocumented
60 1478 my ( $this, $kernel, $stored ) = @_;
61 0 ▶ unless ( defined $stored ) { return DWH_File::Value::Undef->new }
Branch: 3 branches
BranchTrueFalseTotal
if (defined $stored) { } 1478 0 1478
if (do { $stored eq '%' }) { } 0 1478 1478
elsif (my $val = $kernel->activate_reference($stored)) { } 295 1183 1478
62 0 elsif ( $stored eq '%' ) { return DWH_File::Value::Undef->new }
63 elsif ( my $val = $kernel->activate_reference( $stored ) ) {
64 295 return $val;
65 }
66 1183 else { return DWH_File::Value::Plain->from_stored( $stored ) }
67 }
68  
69 9 1;
70  
71 __END__
↑ Summary DWH_File/Tie/Array.pm »