SharedFork/Scalar.pm

filter: Statementstmt 50.0% 10 / 20 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod n/a totaltotal 46.4% 13 / 28 CC 2 SCAR 10.0
CC
2
Cov
45%
TIESCALAR
6.0
FETCH
2.0
STORE
2.0
CRAP 2.7
« SharedFork/Store.pm ↑ Summary SharedFork/Array.pm »
1 package Test::SharedFork::Scalar;
2 31 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 31 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 31 ▶use base 'Tie::Scalar';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # create new tied scalar
7 0 ▶sub TIESCALAR {
Subroutine TIESCALAR: not called CC=2 SCAR=17.9
8 0 my ($class, $share, $key) = @_;
9 0 ▶ die "missing key" unless $key;
Branch: 1 branch
BranchTrueFalseTotal
unless $key 0 0 0
10 0 bless { share => $share, key => $key }, $class;
11 }
12  
13 0 ▶sub FETCH {
Subroutine FETCH: not called CC=1 SCAR=6.9
14 0 my $self = shift;
15 0 my $lock = $self->{share}->get_lock();
16 0 $self->{share}->get($self->{key});
17 }
18  
19 0 ▶sub STORE {
Subroutine STORE: not called CC=1 SCAR=6.9
20 0 my ($self, $val) = @_;
21 0 my $share = $self->{share};
22 0 my $lock = $self->{share}->get_lock();
23 0 $share->set($self->{key} => $val);
24 }
25  
26 31 1;
« SharedFork/Store.pm ↑ Summary SharedFork/Array.pm »