Conveyor/App/Mutex.pm

filter: Statementstmt 66.6% 20 / 30 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 77.7% 7 / 9 Podpod 100% 1 / 1 totaltotal 54.9% 28 / 51 CC 5 SCAR 18.0
CC
5
Cov
51%
app_init
12.0
DESTROY
12.0
BEGIN
1.0
CRAP 6.1
« Conveyor/Ticket/Payload/Instruction/Container.pm ↑ Summary Conveyor/Stage/SingleTicket.pm »
1 1 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Data::Conveyor::App::Mutex;
6 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 $Data::Conveyor::App::Mutex::VERSION = '1.103130';
8 }
9 # ABSTRACT: Stage-based conveyor-belt-like ticket handling system
10 1 ▶use Error::Hierarchy::Util 'assert_defined';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Data::Conveyor::Mutex;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use parent 'Class::Scaffold::App::CommandLine';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 # define the 'mutex' accessor via 'get_set_std', not via 'object =>
15 # Data::Conveyor::Mutex', because we don't always have a mutex object,
16 # depending on the environment. In DESTROY() we do 'return unless
17 # $self->mutex', which would still trigger the mutex object constructor - so
18 # we avoid that.
19 1 __PACKAGE__->mk_scalar_accessors(qw(mutex_key))
20 ->mk_framework_object_accessors(mutex => 'mutex');
21  
22 0 ▶sub app_init {
Subroutine app_init: not called CC=3 SCAR=24.8
Pod documented
23 0 my $self = shift;
24 0 $self->SUPER::app_init(@_);
25 0 ▶ if ($self->delegate->respect_mutex) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->delegate->respect_mutex) 0 0 0
26 0 assert_defined $self->mutex_key, 'called without set mutex_key.';
27 0 $self->mutex->application($self->mutex_key);
28 0 $self->mutex->mutex_getconf;
29 0 ▶ exit 0 unless $self->mutex->get_mutex;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->mutex->get_mutex 0 0 0
30 }
31 }
32 0 ▶DESTROY {
Subroutine DESTROY: not called CC=3 SCAR=24.8
33 0 my $self = shift;
34 0 ▶ return unless $self->delegate->respect_mutex && $self->mutex;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->delegate->respect_mutex and $self->mutex 0 0 0
Condition0%0/3
$self->delegate->respect_mutex and $self->mutex
!ll&&!rl&&r
000
MC/DC0%0/2
$self->delegate->respect_mutex and $self->mutex
$self->delegate->respect_mutex $self->mutex
Truth table0%0/3
A and B
A= $self->delegate->respect_mutexB= $self->mutex
ABresult
0X0
100
111
35 0 $self->mutex->release_mutex;
36 }
37 1 1;
38  
39  
40 __END__
« Conveyor/Ticket/Payload/Instruction/Container.pm ↑ Summary Conveyor/Stage/SingleTicket.pm »