| 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
| |||||||||||||||||||||
| 22 | elsif ( ref $actual ) { | ||||||||||||||||||||
| 23 | 31 | my $ty; | |||||||||||||||||||
| 24 | 31 | ▶ | if ( UNIVERSAL::isa( $actual, 'DWH_File::Aware' ) ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 25 | 0 | ▶ | $tier ||= $actual->dwh_tier; | ||||||||||||||||||
|
Condition0%0/3
$tier ||= $actual->dwh_tier
MC/DC0%0/2
$tier ||= $actual->dwh_tier
$tier
$actual->dwh_tier
Truth table0%0/3
A ||= B
A= $tierB= $actual->dwh_tier
| |||||||||||||||||||||
| 26 | } | ||||||||||||||||||||
| 27 | 31 | ▶ | if ( UNIVERSAL::isa( $actual, 'SCALAR' ) ) { | ||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||
| 28 | 2 | ▶ | $ty = tied $$actual or $tier ||= 'DWH_File::Tie::Scalar'; | ||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$tier ||= "DWH_File::Tie::Scalar"
MC/DC0%0/1
$tier ||= "DWH_File::Tie::Scalar"
$tier
Truth table50%1/2
A
A= $tier
| |||||||||||||||||||||
| 29 | } | ||||||||||||||||||||
| 30 | elsif ( UNIVERSAL::isa( $actual, 'ARRAY' ) ) { | ||||||||||||||||||||
| 31 | 16 | ▶ | $ty = tied @$actual or $tier ||= 'DWH_File::Tie::Array'; | ||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$tier ||= "DWH_File::Tie::Array"
MC/DC0%0/1
$tier ||= "DWH_File::Tie::Array"
$tier
Truth table50%1/2
A
A= $tier
| |||||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | elsif ( UNIVERSAL::isa( $actual, 'HASH' ) ) { | ||||||||||||||||||||
| 34 | 13 | ▶ | $ty = tied %$actual or $tier ||= 'DWH_File::Tie::Hash' | ||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$tier ||= "DWH_File::Tie::Hash"
MC/DC100%1/1
$tier ||= "DWH_File::Tie::Hash"
$tier
Truth table100%2/2
A
A= $tier
| |||||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | 0 | else { die "Unable to tie $actual" } | |||||||||||||||||||
| 37 | 31 | ▶ | if ( $ty ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 38 | 3 | ▶ | if ( $ty->isa( 'DWH_File::Tie' ) ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 39 | 3 | ▶ | if ( $ty->{ kernel } == $kernel ) { return $ty } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||