Shm/Tied/SCALAR.pm

filter: Statementstmt 100% 48 / 48 Branchbran 75.0% 9 / 12 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 10 / 10 Podpod 100% 1 / 1 totaltotal 91.3% 74 / 81 CC 9 SCAR 9.9
CC
9
Cov
92%
CLEAR
4.1
STORE
4.0
FETCH
3.0
CRAP 2.7
« Shm/Tied/HASH.pm ↑ Summary
1 package IPC::Shm::Tied::SCALAR;
2 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 #
7 # Copyright (c) 2014 by Kevin Cody-Little <kcody@cpan.org>
8 #
9 # This code may be modified or redistributed under the terms
10 # of either the Artistic or GNU General Public licenses, at
11 # the modifier or redistributor's discretion.
12 #
13  
14 =head1 NAME
15  
16 IPC::Shm::Tied::HASH
17  
18 =head1 SYNOPSIS
19  
20 This class is part of the IPC::Shm implementation. You should not be using it directly.
21  
22 =cut
23  
24 # Loaded from IPC::Shm::Tied, so don't reload it
25 6 ▶use vars qw( @ISA );
Subroutine BEGIN: called CC=1 SCAR=0.0
26 6 @ISA = qw( IPC::Shm::Tied );
27  
28 6 ▶use IPC::Shm::Make;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30  
31 9 ▶sub EMPTY {
Subroutine EMPTY: called CC=1 SCAR=0.0
Pod documented
32 9 return \undef;
33 }
34  
35 7 ▶sub TIESCALAR {
Subroutine TIESCALAR: called CC=1 SCAR=0.0
36 7 my ( $class, $this ) = @_;
37  
38 7 return bless $this, $class;
39 }
40  
41 35 ▶sub FETCH {
Subroutine FETCH: called CC=3 SCAR=11.0
42 35 my ( $this ) = @_;
43  
44 35 my $locked = $this->readlock;
45  
46 35 $this->fetch;
47  
48 35 ▶ $this->unlock if $locked;
Branch: 1 branch
BranchTrueFalseTotal
if $locked 35 0 35
49  
50 35 my $rv = ${$this->vcache};
51  
52 35 ▶ return ref( $rv ) ? getback( $rv ) : $rv;
Branch: 1 branch
BranchTrueFalseTotal
ref $rv ? : 11 24 35
53 }
54  
55 14 ▶sub STORE {
Subroutine STORE: called CC=4 SCAR=13.9
56 14 my ( $this, $value ) = @_;
57  
58 14 makeshm( \$value );
59  
60 14 my $locked = $this->writelock;
61  
62 14 $this->fetch;
63 14 my $oldval = ${$this->vcache};
64  
65 14 $this->vcache( \$value );
66 14 $this->flush;
67  
68 14 ▶ $this->unlock if $locked;
Branch: 1 branch
BranchTrueFalseTotal
if $locked 14 0 14
69  
70 14 ▶ $this->standin_discard( $oldval ) if ( $oldval and ref( $oldval ) );
Branch: 1 branch
BranchTrueFalseTotal
if $oldval and ref $oldval 2 12 14
Condition100%3/3
$oldval and ref $oldval
!ll&&!rl&&r
572
MC/DC100%2/2
$oldval and ref $oldval
$oldval ref $oldval
Truth table100%3/3
A and B
A= $oldvalB= ref $oldval
ABresult
0X0
100
111
71  
72 14 return $value;
73 }
74  
75 2 ▶sub CLEAR {
Subroutine CLEAR: called CC=4 SCAR=14.1
76 2 my ( $this ) = @_;
77  
78 2 my $locked = $this->writelock;
79  
80 2 $this->fetch;
81 2 my $oldval = ${$this->vcache};
82  
83 2 $this->vcache( $this->EMPTY );
84 2 $this->flush;
85  
86 2 ▶ $this->unlock if $locked;
Branch: 1 branch
BranchTrueFalseTotal
if $locked 1 1 2
87  
88 2 ▶ $this->standin_discard( $oldval ) if ( $oldval and ref( $oldval ) );
Branch: 1 branch
BranchTrueFalseTotal
if $oldval and ref $oldval 0 2 2
Condition33%1/3
$oldval and ref $oldval
!ll&&!rl&&r
200
MC/DC0%0/2
$oldval and ref $oldval
$oldval ref $oldval
Truth table33%1/3
A and B
A= $oldvalB= ref $oldval
ABresult
0X0
100
111
89  
90 2 return 1;
91 }
92  
93  
94  
95 =head1 AUTHOR
96  
97 Kevin Cody-Little <kcody@cpan.org>
98  
99 =cut
100  
101 6 1;
« Shm/Tied/HASH.pm ↑ Summary