Conveyor/App/Exported/Launcher.pm

filter: Statementstmt 58.9% 23 / 39 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 8 / 10 Podpod 100% 2 / 2 totaltotal 51.5% 33 / 64 CC 7 SCAR 32.2
CC
7
Cov
46%
start
56.0
usage
2.0
BEGIN
1.0
CRAP 25.1
« Conveyor/YAML/Marshall/Payload/InstructionContainer.pm ↑ Summary Conveyor/Exception/Container.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::Exported::Launcher;
6 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 $Data::Conveyor::App::Exported::Launcher::VERSION = '1.103130';
8 }
9 # ABSTRACT: Stage-based conveyor-belt-like ticket handling system
10  
11 1 ▶use Getopt::Long;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use IO::Handle;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use FindBin '$Bin';
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 our @EXPORT = qw(start);
16  
17 0 ▶sub start {
Subroutine start: not called CC=7 SCAR=40.3
Pod documented
18 0 STDOUT->autoflush;
19 0 STDERR->autoflush;
20 0 my %opt;
21 0 GetOptions(
22 \%opt, qw/
23 lockpath=s
24 parallel=s
25 /
26 );
27 0 ▶ usage() unless defined $opt{parallel} && $opt{lockpath};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $opt{"parallel"} and $opt{"lockpath"} 0 0 0
Condition0%0/3
defined $opt{"parallel"} and $opt{"lockpath"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $opt{"parallel"} and $opt{"lockpath"}
defined $opt{"parallel"} $opt{"lockpath"}
Truth table0%0/3
A and B
A= defined $opt{"parallel"}B= $opt{"lockpath"}
ABresult
0X0
100
111
28 0 for (qw/PROJROOT CF_CONF PERL5OPT/) {
29 0 ▶ die "$_ not set" unless $ENV{$_};
Branch: 1 branch
BranchTrueFalseTotal
unless $ENV{$_} 0 0 0
30 }
31 0 my @executable = ("$Bin/reg_dispatch.pl", "--lockpath=$opt{lockpath}");
32 0 require Data::Conveyor::Lock::Dispatcher;
33 my $lockclass = Data::Conveyor::Lock::Dispatcher->new(
34 lockpath => $opt{lockpath},
35 numlocks => $opt{parallel}
36 0 );
37 0 $lockclass->administrate_locks;
38  
39 # we lose the lock here, of course. in the worst case
40 # though, we just bloat and finally end up without the lock.
41 0 ▶ if ($lockclass->get_lock) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lockclass->get_lock) 0 0 0
42 0 ▶ exec $^X, @executable or die "exec @executable failed.";
Branch: 1 branch
BranchTrueFalseTotal
exec $^X, @executable or die "exec @executable failed." 0 0 0
43 }
44 }
45  
46 0 ▶sub usage () {
Subroutine usage: not called CC=1 SCAR=6.9
Pod documented
47 0 (my $exe = $0) =~ s|.*/||;
48 0 printf STDERR <<'__EOF', $exe;
49  
50 Usage:
51 %s --lockpath=<directory> --parallel=<n>
52  
53 __EOF
54 0 exit;
55 }
56 1 1;
57  
58  
59 __END__
« Conveyor/YAML/Marshall/Payload/InstructionContainer.pm ↑ Summary Conveyor/Exception/Container.pm »