Property/RW/Lazy/CustomSet.pm

filter: Statementstmt 50.0% 12 / 24 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod n/a totaltotal 47.0% 16 / 34 CC 3 SCAR 12.5
CC
3
Cov
43%
STORE
6.0
FETCH
6.0
BEGIN
1.0
CRAP 3.5
« Property.pm ↑ Summary Property/RW/Lazy.pm »
1 package Class::Property::RW::Lazy::CustomSet;
2 1 ▶use strict; use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use parent 'Class::Property::RW';
Subroutine BEGIN: called CC=1 SCAR=0.0
4
5 sub TIESCALAR
6 1 ▶{
Subroutine TIESCALAR: called CC=1 SCAR=0.0
7 1 my( $class, $field, $init, $setter, $flag_ref ) = @_;
8 1 return bless {
9 'field' => $field
10 , 'init' => $init
11 , 'setter' => $setter
12 , 'flag_ref' => $flag_ref
13 }, $class;
14 }
15
16 sub STORE
17 0 ▶{
Subroutine STORE: not called CC=2 SCAR=17.9
18 0 my( $self, $value ) = @_;
19 0 $self->{'setter'}->($self->{'object'}, $value );
20 0 ▶ if( not defined $self->{'flag_ref'}->{$self->{'object'}} )
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"flag_ref"}{$self->{"object"}}) 0 0 0
21 {
22 0 $self->{'flag_ref'}->{$self->{'object'}} = $self->{'object'};
23 0 Scalar::Util::weaken($self->{'flag_ref'}->{$self->{'object'}});
24 }
25 0 return;
26 }
27
28 sub FETCH
29 0 ▶{
Subroutine FETCH: not called CC=2 SCAR=17.9
30 0 my( $self ) = @_;
31
32 0 ▶ if( not defined $self->{'flag_ref'}->{$self->{'object'}} )
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"flag_ref"}{$self->{"object"}}) 0 0 0
33 {
34 0 $self->{'flag_ref'}->{$self->{'object'}} = $self->{'object'};
35 0 Scalar::Util::weaken($self->{'flag_ref'}->{$self->{'object'}});
36 0 $self->{'setter'}->($self->{'object'}, $self->{'init'}->($self->{'object'}));
37 }
38
39 0 return $self->{'object'}->{$self->{'field'}};
40 }
41
42 1 1;
« Property.pm ↑ Summary Property/RW/Lazy.pm »