| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
$self->delegate->respect_mutex and $self->mutex
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
| |||||||||||||||||||||||||||||
| 35 | 0 | $self->mutex->release_mutex; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | 1 | 1; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | __END__ | ||||||||||||||||||||||||||||