auto/share/dist/Inline-Module/CPPConfig.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 11 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 67 CC 5 SCAR 22.3
CC
5
Cov
0%
guess
20.0
throw
6.0
_trim_whitespace
2.0
CRAP 9.3
1 # This module comes from Inline::Module share file: 'CPPConfig.pm'
2  
3 use strict; use warnings;
4 package Inline::CPP::Config;
5  
6 use Config;
7 use ExtUtils::CppGuess;
8  
9 our ($compiler, $libs, $iostream_fn, $cpp_flavor_defs) = guess();
10  
11 sub guess {
12 my ($compiler, $libs, $iostream_fn, $cpp_flavor_defs);
13 $iostream_fn = 'iostream';
14 $cpp_flavor_defs = <<'.';
15 #define __INLINE_CPP_STANDARD_HEADERS 1
16 #define __INLINE_CPP_NAMESPACE_STD 1
17 .
18  
19 if ($Config::Config{osname} eq 'freebsd'
20 && $Config::Config{osvers} =~ /^(\d+)/
21 && $1 >= 10
22 ) {
23 $compiler = 'clang++';
24 $libs = '-lc++';
25 }
26 else {
27 my $guesser = ExtUtils::CppGuess->new;
28 my %configuration = $guesser->module_build_options;
29 if( $guesser->is_gcc ) {
30 $compiler = 'g++';
31 }
32 elsif ( $guesser->is_msvc ) {
33 $compiler = 'cl';
34 }
35  
36 $compiler .= $configuration{extra_compiler_flags};
37 $libs = $configuration{extra_linker_flags};
38  
39 ($compiler, $libs) = map {
40 _trim_whitespace($_)
41 } ($compiler, $libs);
42 }
43 return ($compiler, $libs, $iostream_fn, $cpp_flavor_defs);
44 }
45  
46 sub throw {
47 my $os = $^O;
48 my $msg = "Unsupported OS/Compiler for Inline::Module+Inline::CPP '$os'";
49 die $msg unless
50 $ENV{PERL5_MINISMOKEBOX} ||
51 $ENV{PERL_CR_SMOKER_CURRENT};
52 eval 'use lib "inc"; use Inline::Module; 1' or die $@;
53 Inline::Module->smoke_system_info_dump($msg);
54 }
55  
56 sub _trim_whitespace {
57 my $string = shift;
58 $string =~ s/^\s+|\s+$//g;
59 $string =~ s/\s+/ /g;
60 return $string;
61 }
62  
63 1;