DWH_File/Tie.pm

filter: Statementstmt 93.0% 40 / 43 Branchbran 75.0% 3 / 4 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 78.9% 15 / 19 Podpod 0.0% 0 / 12 totaltotal 67.7% 63 / 93 CC 6 SCAR 5.7
CC
6
Cov
86%
perform_tie
4.1
store_string
2.1
cache_down
2.1
CRAP 1.8
« DWH_File/Value/Plain.pm ↑ Summary DWH_File/ID_Mill.pm »
1 package DWH_File::Tie;
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 use overload
7 9 ▶ '""' => \&store_string,
Subroutine BEGIN: called CC=1 SCAR=0.0
8 9 fallback => 1;
9  
10 9 ▶use DWH_File::Cached;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 9 ▶use DWH_File::Reference;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 9 @ISA = qw( DWH_File::Value DWH_File::Cached DWH_File::Reference );
14 9 $VERSION = 0.01;
15  
16 61 ▶sub perform_tie {
Subroutine perform_tie: called CC=4 SCAR=14.0
Pod undocumented
17 61 my ( $this, $kernel, $ref, $id, $tail ) = @_;
18 61 ▶ my $class = ref $this || $this;
Condition33%1/3
ref $this || $this
l!l&&r!l&&!r
0610
MC/DC0%0/2
ref $this || $this
ref $this $this
Truth table33%1/3
A || B
A= ref $thisB= $this
ABresult
1X1
011
000
19 61 my $self = {
20 content => $ref,
21 kernel => $kernel,
22 string_val => '',
23 cache_count => 0,
24 };
25 61 bless $self, $class;
26 61 ▶ $self->{ id } = $id || $kernel->next_id;
Condition66%2/3
$id || $kernel->next_id
l!l&&r!l&&!r
33280
MC/DC0%0/2
$id || $kernel->next_id
$id $kernel->next_id
Truth table66%2/3
A || B
A= $idB= $kernel->next_id
ABresult
1X1
011
000
27 61 $kernel->tieing( $self );
28 61 ▶ if ( defined $id ) { $self->wake_up_call( $tail ) }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $id) { } 33 28 61
29 28 else { $self->sign_in_first_time }
30 61 $kernel->did_tie( $self );
31 61 return $self;
32 }
33  
34 # template methods
35 0 ▶sub wake_up_call {} # param: tail
Subroutine wake_up_call: not called CC=1 SCAR=0.0
Pod undocumented
36 0 ▶sub sign_in_first_time {}
Subroutine sign_in_first_time: not called CC=1 SCAR=0.0
Pod undocumented
37 0 ▶sub custom_grounding { '' };
Subroutine custom_grounding: not called CC=1 SCAR=6.9
Pod undocumented
38  
39 # overridden method from DWH_File::Value
40 305 ▶sub actual_value { $_[ 0 ]->{ content } }
Subroutine actual_value: called CC=1 SCAR=0.0
Pod undocumented
41  
42 889 ▶sub store_string {
Subroutine store_string: called CC=2 SCAR=7.2
Pod undocumented
43 $_[ 0 ]->{ string_val } ||= $_[ 0 ]->{ kernel }->
44 889 ▶ reference_string( $_[ 0 ] );
Condition66%2/3
$_[0]{"string_val"} ||= $_[0]{"kernel"}->reference_string($_[0])
l!l&&r!l&&!r
841480
MC/DC0%0/2
$_[0]{"string_val"} ||= $_[0]{"kernel"}->reference_string($_[0])
$_[0]{"string_val"} $_[0]{"kernel"}->reference_string($_[0])
Truth table66%2/3
A ||= B
A= $_[0]{"string_val"}B= $_[0]{"kernel"}->reference_string($_[0])
ABresult
1X1
011
000
45 }
46  
47 74 ▶sub cache_key { $_[ 0 ]->{ id } }
Subroutine cache_key: called CC=1 SCAR=0.0
Pod undocumented
48  
49 61 ▶sub cache_up { $_[ 0 ]->{ cache_count }++ }
Subroutine cache_up: called CC=1 SCAR=0.0
Pod undocumented
50  
51 13 ▶sub cache_down {
Subroutine cache_down: called CC=2 SCAR=7.2
Pod undocumented
52 13 $_[ 0 ]->{ cache_count }--;
53 13 ▶ $_[ 0 ]->{ cache_count } or $_[ 0 ]->cache_out;
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"cache_count"} or $_[0]->cache_out 0 13 13
54 }
55  
56 13 ▶sub cache_out {}
Subroutine cache_out: called CC=1 SCAR=0.0
Pod undocumented
57  
58 27 ▶sub bump_refcount {
Subroutine bump_refcount: called CC=1 SCAR=0.0
Pod undocumented
59 27 $_[ 0 ]->{ kernel }->bump_refcount( $_[ 0 ]->{ id } );
60 }
61  
62 2 ▶sub cut_refcount {
Subroutine cut_refcount: called CC=1 SCAR=0.0
Pod undocumented
63 2 $_[ 0 ]->{ kernel }->cut_refcount( $_[ 0 ]->{ id } );
64 }
65  
66 0 ▶sub DESTROY {
Subroutine DESTROY: not called CC=1 SCAR=6.9
67 0 %{ $_[ 0 ] } = ();
68 }
69  
70 9 1;
71  
72 __END__
« DWH_File/Value/Plain.pm ↑ Summary DWH_File/ID_Mill.pm »