blib/lib/Filter/cpp.pm

filter: Statementstmt 80.5% 29 / 36 Branchbran 58.3% 7 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 77.3% 41 / 53 CC 2 SCAR 3.2
CC
2
Cov
75%
import
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« blib/lib/Filter/exec.pm ↑ Summary decrypt/encrypt »
1 package Filter::cpp;
2
3 1 ▶use Filter::Util::Exec ;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Config ;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '1.64' ;
9  
10 1 my $cpp;
11 my $sep;
12 1 ▶if ($^O eq 'MSWin32') {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 1 1
13 0 $cpp = 'cpp.exe' ;
14 0 $sep = ';';
15 }
16 else {
17 1 ($cpp) = $Config{cppstdin} =~ /^(\S+)/;
18 1 $sep = ':';
19 }
20  
21 1 ▶if (! $cpp) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($cpp) 0 1 1
22 0 require Carp;
23 0 Carp::croak ("Cannot find cpp\n");
24 }
25  
26 # Check if cpp is installed
27 1 ▶if ( ! -x $cpp) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-x $cpp) 1 0 1
28 1 my $foundCPP = 0 ;
29 1 foreach my $dir (split($sep, $ENV{PATH}), '')
30 {
31 7 ▶ if (-x "$dir/$cpp")
Branch: 1 branch
BranchTrueFalseTotal
if (-x "$dir/$cpp") 1 6 7
32 {
33 1 $foundCPP = 1;
34 1 last ;
35 }
36 }
37  
38 1 ▶ if (! $foundCPP) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($foundCPP) 0 1 1
39 0 require Carp;
40 0 Carp::croak("Cannot find cpp\n");
41 }
42 }
43  
44 sub import
45 {
46 1 ▶ my($self, @args) = @_ ;
Subroutine import: called CC=2 SCAR=7.6
47  
48 1 ▶ if ($^O eq 'MSWin32') {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 1 1
49 0 Filter::Util::Exec::filter_add ($self, 'cmd', '/c',
50 "cpp.exe 2>nul") ;
51 }
52 else {
53 1 Filter::Util::Exec::filter_add ($self, 'sh', '-c',
54 "$Config{'cppstdin'} $Config{'cppminus'} 2>/dev/null") ;
55 }
56 }
57  
58 1 1 ;
59 __END__
« blib/lib/Filter/exec.pm ↑ Summary decrypt/encrypt »