PAR/SetupProgname.pm

filter: Statementstmt 35.9% 23 / 64 Branchbran 12.5% 5 / 40 Conditioncond 19.0% 4 / 21 MC/DCmcdc 7.1% 1 / 14 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 2 totaltotal 25.8% 38 / 147 CC 29 SCAR 48.8
CC
29
Cov
26%
set_progname
149.6
set_progname
149.6
BEGIN
1.0
CRAP 132.1
« PAR/Heavy.pm ↑ Summary PAR.pm »
1 package PAR::SetupProgname;
2 4 $PAR::SetupProgname::VERSION = '1.002';
3  
4 4 ▶use 5.008009;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head1 NAME
10  
11 PAR::SetupProgname - Setup $ENV{PAR_PROGNAME}
12  
13 =head1 SYNOPSIS
14  
15 PAR guts, beware. Check L<PAR>
16  
17 =head1 DESCRIPTION
18  
19 Routines to setup the C<PAR_PROGNAME> environment variable.
20 Read the C<PAR::Environment> manual.
21  
22 The C<set_progname()> subroutine sets up the C<PAR_PROGNAME>
23 environment variable
24  
25 =cut
26  
27 # for PAR internal use only!
28 4 ▶our $Progname = $ENV{PAR_PROGNAME} || $0;
Condition33%1/3
$ENV{'PAR_PROGNAME'} || $0
l!l&&r!l&&!r
040
MC/DC0%0/2
$ENV{'PAR_PROGNAME'} || $0
$ENV{'PAR_PROGNAME'} $0
Truth table33%1/3
A || B
A= $ENV{'PAR_PROGNAME'}B= $0
ABresult
1X1
011
000
29  
30 # same code lives in PAR::Packer's par.pl!
31 7 ▶sub set_progname {
Subroutine set_progname: called CC=15 SCAR=50.1
Pod undocumented
32 0 ▶ require File::Spec;
Subroutine set_progname: not called CC=15 SCAR=50.1
Pod undocumented
33  
34 0 ▶ if (defined $ENV{PAR_PROGNAME} and $ENV{PAR_PROGNAME} =~ /(.+)/) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $ENV{"PAR_PROGNAME"} and $ENV{"PAR_PROGNAME"} =~ /(.+)/) 0 0 0
if (defined $ENV{"PAR_PROGNAME"} and $ENV{"PAR_PROGNAME"} =~ /(.+)/) 3 4 7
Condition33%2/6
defined $ENV{"PAR_PROGNAME"} and $ENV{"PAR_PROGNAME"} =~ /(.+)/
!ll&&!rl&&r
000
defined $ENV{"PAR_PROGNAME"} and $ENV{"PAR_PROGNAME"} =~ /(.+)/
!ll&&!rl&&r
403
MC/DC0%0/2
defined $ENV{"PAR_PROGNAME"} and $ENV{"PAR_PROGNAME"} =~ /(.+)/
defined $ENV{"PAR_PROGNAME"} $ENV{"PAR_PROGNAME"} =~ /(.+)/
MC/DC50%1/2
defined $ENV{"PAR_PROGNAME"} and $ENV{"PAR_PROGNAME"} =~ /(.+)/
defined $ENV{"PAR_PROGNAME"} $ENV{"PAR_PROGNAME"} =~ /(.+)/
Truth table0%0/3
A and B
A= defined $ENV{"PAR_PROGNAME"}B= $ENV{"PAR_PROGNAME"} =~ /(.+)/
ABresult
0X0
100
111
Truth table66%2/3
A and B
A= defined $ENV{"PAR_PROGNAME"}B= $ENV{"PAR_PROGNAME"} =~ /(.+)/
ABresult
0X0
100
111
35 0 $Progname = $1;
36 }
37 0 ▶ $Progname = $0 if not defined $Progname;
Branch: 2 branches
BranchTrueFalseTotal
unless defined $PAR::SetupProgname::Progname 0 0 0
unless defined $PAR::SetupProgname::Progname 0 7 7
38  
39 0 ▶ if (( () = File::Spec->splitdir($Progname) ) > 1 or !$ENV{PAR_PROGNAME}) {
Branch: 2 branches
BranchTrueFalseTotal
if ((() = "File::Spec"->splitdir($PAR::SetupProgname::Progname)) > 1 or not $ENV{"PAR_PROGNAME"}) 0 0 0
if ((() = "File::Spec"->splitdir($PAR::SetupProgname::Progname)) > 1 or not $ENV{"PAR_PROGNAME"}) 7 0 7
Condition16%1/6
(() = "File::Spec"->splitdir($PAR::SetupProgname::Progname)) > 1 or not $ENV{"PAR_PROGNAME"}
l!l&&r!l&&!r
000
(() = "File::Spec"->splitdir($PAR::SetupProgname::Progname)) > 1 or not $ENV{"PAR_PROGNAME"}
l!l&&r!l&&!r
700
MC/DC0%0/2
(() = "File::Spec"->splitdir($PAR::SetupProgname::Progname)) > 1 or not $ENV{"PAR_PROGNAME"}
(() = "File::Spec"->splitdir($PAR::SetupProgname::Progname)) > 1 not $ENV{"PAR_PROGNAME"}
MC/DC0%0/2
(() = "File::Spec"->splitdir($PAR::SetupProgname::Progname)) > 1 or not $ENV{"PAR_PROGNAME"}
(() = "File::Spec"->splitdir($PAR::SetupProgname::Progname)) > 1 not $ENV{"PAR_PROGNAME"}
Truth table0%0/3
A or not(B)
A= (() = "File::Spec"->splitdir($PAR::SetupProgname::Progname)) > 1B= not $ENV{"PAR_PROGNAME"}
ABresult
1X1
011
000
Truth table33%1/3
A or not(B)
A= (() = "File::Spec"->splitdir($PAR::SetupProgname::Progname)) > 1B= not $ENV{"PAR_PROGNAME"}
ABresult
1X1
011
000
40 0 my $name = $Progname;
41 0 ▶ if (-s $name) { $Progname = $name; return }
Branch: 2 branches
BranchTrueFalseTotal
if (-s $name) 0 0 0
if (-s $name) 7 0 7
42 0 ▶ if ($Config{_exe}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PAR::SetupProgname::Config{"_exe"}) 0 0 0
if ($PAR::SetupProgname::Config{"_exe"}) 0 0 0
43 0 $name = "$Progname$Config{_exe}";
44 0 ▶ if (-s $name) { $Progname = $name; return }
Branch: 2 branches
BranchTrueFalseTotal
if (-s $name) 0 0 0
if (-s $name) 0 0 0
45 }
46 }
47  
48 0 foreach my $dir (split /\Q$Config{path_sep}\E/, $ENV{PATH}) {
49 0 ▶ next if exists $ENV{PAR_TEMP} and $dir eq $ENV{PAR_TEMP};
Branch: 2 branches
BranchTrueFalseTotal
if exists $ENV{"PAR_TEMP"} and $dir eq $ENV{"PAR_TEMP"} 0 0 0
if exists $ENV{"PAR_TEMP"} and $dir eq $ENV{"PAR_TEMP"} 0 0 0
Condition0%0/6
exists $ENV{"PAR_TEMP"} and $dir eq $ENV{"PAR_TEMP"}
!ll&&!rl&&r
000
exists $ENV{"PAR_TEMP"} and $dir eq $ENV{"PAR_TEMP"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $ENV{"PAR_TEMP"} and $dir eq $ENV{"PAR_TEMP"}
exists $ENV{"PAR_TEMP"} $dir eq $ENV{"PAR_TEMP"}
MC/DC0%0/2
exists $ENV{"PAR_TEMP"} and $dir eq $ENV{"PAR_TEMP"}
exists $ENV{"PAR_TEMP"} $dir eq $ENV{"PAR_TEMP"}
Truth table0%0/3
A and B
A= exists $ENV{"PAR_TEMP"}B= $dir eq $ENV{"PAR_TEMP"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= exists $ENV{"PAR_TEMP"}B= $dir eq $ENV{"PAR_TEMP"}
ABresult
0X0
100
111
50 0 my $name = File::Spec->catfile($dir, $Progname);
51 0 ▶ if (-s $name) { $Progname = $name; return }
Branch: 2 branches
BranchTrueFalseTotal
if (-s $name) 0 0 0
if (-s $name) 0 0 0
52 0 ▶ if ($Config{_exe}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PAR::SetupProgname::Config{"_exe"}) 0 0 0
if ($PAR::SetupProgname::Config{"_exe"}) 0 0 0
53 0 $name = File::Spec->catfile($dir, "$Progname$Config{_exe}");
54 0 ▶ if (-s $name) { $Progname = $name; return }
Branch: 2 branches
BranchTrueFalseTotal
if (-s $name) 0 0 0
if (-s $name) 0 0 0
55 }
56 }
57 }
58  
59  
60 4 1;
61  
62 __END__
« PAR/Heavy.pm ↑ Summary PAR.pm »