blib/lib/Config/Perl/V.pm

filter: Statementstmt 95.9% 119 / 124 Branchbran 82.1% 46 / 56 Conditioncond 58.6% 34 / 58 MC/DCmcdc 41.1% 14 / 34 Subroutinesub 100% 9 / 9 Podpod 100% 4 / 4 totaltotal 79.3% 226 / 285 CC 56 SCAR 30.9
CC
56
Cov
84%
_make_derived
42.9
plv2hash
19.1
summary
9.0
CRAP 22.0
↑ Summary /dev/null »
1 package Config::Perl::V;
2  
3 36 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 36 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 36 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 36 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 36 our $VERSION = "0.40";
9 36 our @ISA = qw( Exporter );
10 36 our @EXPORT_OK = qw( plv2hash summary myconfig signature );
11 36 our %EXPORT_TAGS = (
12 'all' => [ @EXPORT_OK ],
13 'sig' => [ "signature" ],
14 );
15  
16 # Characteristics of this binary (from libperl):
17 # Compile-time options: DEBUGGING PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
18 # USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO
19  
20 # The list are as the perl binary has stored it in PL_bincompat_options
21 # search for it in
22 # perl.c line 1643 S_Internals_V ()
23 # perl -ne'(/^S_Internals_V/../^}/)&&s/^\s+"( .*)"/$1/ and print' perl.c
24 # perl.h line 4566 PL_bincompat_options
25 # perl -ne'(/^\w.*PL_bincompat/../^\w}/)&&s/^\s+"( .*)"/$1/ and print' perl.h
26 36 my %BTD = map {( $_ => 0 )} qw(
27  
28 DEBUGGING
29 HAS_LONG_DOUBLE
30 HAS_STRTOLD
31 NO_HASH_SEED
32 NO_MATHOMS
33 NO_PERL_INTERNAL_RAND_SEED
34 NO_PERL_RAND_SEED
35 NO_TAINT_SUPPORT
36 PERL_BOOL_AS_CHAR
37 PERL_COPY_ON_WRITE
38 PERL_DISABLE_PMC
39 PERL_DONT_CREATE_GVSV
40 PERL_EXTERNAL_GLOB
41 PERL_HASH_FUNC_DJB2
42 PERL_HASH_FUNC_MURMUR3
43 PERL_HASH_FUNC_ONE_AT_A_TIME
44 PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
45 PERL_HASH_FUNC_ONE_AT_A_TIME_OLD
46 PERL_HASH_FUNC_SDBM
47 PERL_HASH_FUNC_SIPHASH
48 PERL_HASH_FUNC_SUPERFAST
49 PERL_IS_MINIPERL
50 PERL_MALLOC_WRAP
51 PERL_MEM_LOG
52 PERL_MEM_LOG_ENV
53 PERL_MEM_LOG_ENV_FD
54 PERL_MEM_LOG_NOIMPL
55 PERL_MEM_LOG_STDERR
56 PERL_MEM_LOG_TIMESTAMP
57 PERL_NEW_COPY_ON_WRITE
58 PERL_OP_PARENT
59 PERL_PERTURB_KEYS_DETERMINISTIC
60 PERL_PERTURB_KEYS_DISABLED
61 PERL_PERTURB_KEYS_RANDOM
62 PERL_PRESERVE_IVUV
63 PERL_RC_STACK
64 PERL_RELOCATABLE_INCPUSH
65 PERL_USE_ATOMIC
66 PERL_USE_DEVEL
67 PERL_USE_SAFE_PUTENV
68 PERL_USE_UNSHARED_KEYS_IN_LARGE_HASHES
69 SILENT_NO_TAINT_SUPPORT
70 UNLINK_ALL_VERSIONS
71 USE_ATTRIBUTES_FOR_PERLIO
72 USE_FAST_STDIO
73 USE_HASH_SEED_EXPLICIT
74 USE_LOCALE
75 USE_LOCALE_CTYPE
76 USE_NO_REGISTRY
77 USE_PERL_ATOF
78 USE_SITECUSTOMIZE
79 USE_THREAD_SAFE_LOCALE
80  
81 DEBUG_LEAKING_SCALARS
82 DEBUG_LEAKING_SCALARS_FORK_DUMP
83 DECCRTL_SOCKETS
84 FAKE_THREADS
85 FCRYPT
86 HAS_TIMES
87 HAVE_INTERP_INTERN
88 MULTIPLICITY
89 MYMALLOC
90 NO_HASH_SEED
91 PERL_DEBUG_READONLY_COW
92 PERL_DEBUG_READONLY_OPS
93 PERL_GLOBAL_STRUCT
94 PERL_GLOBAL_STRUCT_PRIVATE
95 PERL_HASH_NO_SBOX32
96 PERL_HASH_USE_SBOX32
97 PERL_IMPLICIT_CONTEXT
98 PERL_IMPLICIT_SYS
99 PERLIO_LAYERS
100 PERL_MAD
101 PERL_MICRO
102 PERL_NEED_APPCTX
103 PERL_NEED_TIMESBASE
104 PERL_OLD_COPY_ON_WRITE
105 PERL_POISON
106 PERL_SAWAMPERSAND
107 PERL_TRACK_MEMPOOL
108 PERL_USES_PL_PIDSTATUS
109 PL_OP_SLAB_ALLOC
110 THREADS_HAVE_PIDS
111 USE_64_BIT_ALL
112 USE_64_BIT_INT
113 USE_IEEE
114 USE_ITHREADS
115 USE_LARGE_FILES
116 USE_LOCALE_COLLATE
117 USE_LOCALE_NUMERIC
118 USE_LOCALE_TIME
119 USE_LONG_DOUBLE
120 USE_PERLIO
121 USE_QUADMATH
122 USE_REENTRANT_API
123 USE_SFIO
124 USE_SOCKS
125 VMS_DO_SOCKETS
126 VMS_SHORTEN_LONG_SYMBOLS
127 VMS_SYMBOL_CASE_AS_IS
128 );
129  
130 # These are all the keys that are
131 # 1. Always present in %Config - lib/Config.pm #87 tie %Config
132 # 2. Reported by 'perl -V' (the rest)
133 36 my @config_vars = qw(
134  
135 api_subversion
136 api_version
137 api_versionstring
138 archlibexp
139 dont_use_nlink
140 d_readlink
141 d_symlink
142 exe_ext
143 inc_version_list
144 ldlibpthname
145 patchlevel
146 path_sep
147 perl_patchlevel
148 privlibexp
149 scriptdir
150 sitearchexp
151 sitelibexp
152 subversion
153 usevendorprefix
154 version
155  
156 git_commit_id
157 git_describe
158 git_branch
159 git_uncommitted_changes
160 git_commit_id_title
161 git_snapshot_date
162  
163 package revision version_patchlevel_string
164  
165 osname osvers archname
166 myuname
167 config_args
168 hint useposix d_sigaction
169 useithreads usemultiplicity
170 useperlio d_sfio uselargefiles usesocks
171 use64bitint use64bitall uselongdouble
172 usemymalloc default_inc_excludes_dot bincompat5005
173  
174 cc ccflags
175 optimize
176 cppflags
177 ccversion gccversion gccosandvers
178 intsize longsize ptrsize doublesize byteorder
179 d_longlong longlongsize d_longdbl longdblsize
180 ivtype ivsize nvtype nvsize lseektype lseeksize
181 alignbytes prototype
182  
183 ld ldflags
184 libpth
185 libs
186 perllibs
187 libc so useshrplib libperl
188 gnulibc_version
189  
190 dlsrc dlext d_dlsymun ccdlflags
191 cccdlflags lddlflags
192 );
193  
194 36 my %empty_build = (
195 'osname' => "",
196 'stamp' => 0,
197 'options' => { %BTD },
198 'patches' => [],
199 );
200  
201 83 ▶sub _make_derived {
Subroutine _make_derived: called CC=21 SCAR=37.6
202 83 my $conf = shift;
203  
204 83 for ( [ 'lseektype' => "Off_t" ],
205 [ 'myuname' => "uname" ],
206 [ 'perl_patchlevel' => "patch" ],
207 ) {
208 249 my ($official, $derived) = @{$_};
209 249 ▶ $conf->{'config'}{$derived} ||= $conf->{'config'}{$official};
Condition100%3/3
$conf->{"config"}{$derived} ||= $conf->{"config"}{$official}
l!l&&r!l&&!r
7916154
MC/DC100%2/2
$conf->{"config"}{$derived} ||= $conf->{"config"}{$official}
$conf->{"config"}{$derived} $conf->{"config"}{$official}
Truth table100%3/3
A ||= B
A= $conf->{"config"}{$derived}B= $conf->{"config"}{$official}
ABresult
1X1
011
000
210 249 ▶ $conf->{'config'}{$official} ||= $conf->{'config'}{$derived};
Condition100%3/3
$conf->{"config"}{$official} ||= $conf->{"config"}{$derived}
l!l&&r!l&&!r
1679154
MC/DC100%2/2
$conf->{"config"}{$official} ||= $conf->{"config"}{$derived}
$conf->{"config"}{$official} $conf->{"config"}{$derived}
Truth table100%3/3
A ||= B
A= $conf->{"config"}{$official}B= $conf->{"config"}{$derived}
ABresult
1X1
011
000
211 249 $conf->{'derived'}{$derived} = delete $conf->{'config'}{$derived};
212 }
213  
214 83 ▶ if (exists $conf->{'config'}{'version_patchlevel_string'} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $conf->{"config"}{"version_patchlevel_string"} and not exists $conf->{"config"}{"api_version"}) 40 43 83
Condition100%3/3
exists $conf->{"config"}{"version_patchlevel_string"} and not exists $conf->{"config"}{"api_version"}
!ll&&!rl&&r
35840
MC/DC100%2/2
exists $conf->{"config"}{"version_patchlevel_string"} and not exists $conf->{"config"}{"api_version"}
exists $conf->{"config"}{"version_patchlevel_string"} not exists $conf->{"config"}{"api_version"}
Truth table100%3/3
A and not(B)
A= exists $conf->{"config"}{"version_patchlevel_string"}B= not exists $conf->{"config"}{"api_version"}
ABresult
0X0
100
111
215 !exists $conf->{'config'}{'api_version'}) {
216 40 my $vps = $conf->{'config'}{'version_patchlevel_string'};
217 $vps =~ s{\b revision \s+ (\S+) }{}x and
218 40 ▶ $conf->{'config'}{'revision'} ||= $1;
Branch: 1 branch
BranchTrueFalseTotal
$vps =~ s/\b revision \s+ (\S+) //x and $conf->{"config"}{"revision"} ||= $1 0 40 40
Condition0%0/3
$conf->{"config"}{"revision"} ||= $1
l!l&&r!l&&!r
000
MC/DC0%0/2
$conf->{"config"}{"revision"} ||= $1
$conf->{"config"}{"revision"} $1
Truth table0%0/3
A ||= B
A= $conf->{"config"}{"revision"}B= $1
ABresult
1X1
011
000
219  
220 $vps =~ s{\b version \s+ (\S+) }{}x and
221 40 ▶ $conf->{'config'}{'api_version'} ||= $1;
Branch: 1 branch
BranchTrueFalseTotal
$vps =~ s/\b version \s+ (\S+) //x and $conf->{"config"}{"api_version"} ||= $1 40 0 40
Condition33%1/3
$conf->{"config"}{"api_version"} ||= $1
l!l&&r!l&&!r
0400
MC/DC0%0/2
$conf->{"config"}{"api_version"} ||= $1
$conf->{"config"}{"api_version"} $1
Truth table33%1/3
A ||= B
A= $conf->{"config"}{"api_version"}B= $1
ABresult
1X1
011
000
222 $vps =~ s{\b subversion \s+ (\S+) }{}x and
223 40 ▶ $conf->{'config'}{'subversion'} ||= $1;
Branch: 1 branch
BranchTrueFalseTotal
$vps =~ s/\b subversion \s+ (\S+) //x and $conf->{"config"}{"subversion"} ||= $1 40 0 40
Condition66%2/3
$conf->{"config"}{"subversion"} ||= $1
l!l&&r!l&&!r
02020
MC/DC50%1/2
$conf->{"config"}{"subversion"} ||= $1
$conf->{"config"}{"subversion"} $1
Truth table66%2/3
A ||= B
A= $conf->{"config"}{"subversion"}B= $1
ABresult
1X1
011
000
224 $vps =~ s{\b patch \s+ (\S+) }{}x and
225 40 ▶ $conf->{'config'}{'perl_patchlevel'} ||= $1;
Branch: 1 branch
BranchTrueFalseTotal
$vps =~ s/\b patch \s+ (\S+) //x and $conf->{"config"}{"perl_patchlevel"} ||= $1 0 40 40
Condition0%0/3
$conf->{"config"}{"perl_patchlevel"} ||= $1
l!l&&r!l&&!r
000
MC/DC0%0/2
$conf->{"config"}{"perl_patchlevel"} ||= $1
$conf->{"config"}{"perl_patchlevel"} $1
Truth table0%0/3
A ||= B
A= $conf->{"config"}{"perl_patchlevel"}B= $1
ABresult
1X1
011
000
226 }
227  
228 ($conf->{'config'}{'version_patchlevel_string'} ||= join " ",
229 0 map { ($_, $conf->{'config'}{$_} ) }
230 83 ▶ grep { $conf->{'config'}{$_} }
Condition66%2/3
$conf->{"config"}{"version_patchlevel_string"} ||= join(" ", map({$_, $conf->{"config"}{$_};} grep({$conf->{"config"}{$_};} "api_version", "subversion", "perl_patchlevel")))
l!l&&r!l&&!r
48035
MC/DC50%1/2
$conf->{"config"}{"version_patchlevel_string"} ||= join(" ", map({$_, $conf->{"config"}{$_};} grep({$conf->{"config"}{$_};} "api_version", "subversion", "perl_patchlevel")))
$conf->{"config"}{"version_patchlevel_string"} join(" ", map({$_, $conf->{"config"}{$_};} grep({$conf->{"config"}{$_};} "api_version", "subversion", "perl_patchlevel")))
Truth table66%2/3
A ||= B
A= $conf->{"config"}{"version_patchlevel_string"}B= join(" ", map({$_, $conf->{"config"}{$_};} grep({$conf->{"config"}{$_};} "api_version", "subversion", "perl_patchlevel")))
ABresult
1X1
011
000
231 qw( api_version subversion perl_patchlevel )) =~ s/\bperl_//;
232  
233 83 ▶ $conf->{'config'}{'perl_patchlevel'} ||= ""; # 0 is not a valid patchlevel
Condition50%1/2
$conf->{"config"}{"perl_patchlevel"} ||= ""
l!l
083
MC/DC0%0/1
$conf->{"config"}{"perl_patchlevel"} ||= ""
$conf->{"config"}{"perl_patchlevel"}
Truth table50%1/2
A
A= $conf->{"config"}{"perl_patchlevel"}
Aresult
11
00
234  
235 83 ▶ if ($conf->{'config'}{'perl_patchlevel'} =~ m{^git\w*-([^-]+)}i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"config"}{"perl_patchlevel"} =~ /^git\w*-([^-]+)/i) 0 83 83
236 0 ▶ $conf->{'config'}{'git_branch'} ||= $1;
Condition0%0/3
$conf->{"config"}{"git_branch"} ||= $1
l!l&&r!l&&!r
000
MC/DC0%0/2
$conf->{"config"}{"git_branch"} ||= $1
$conf->{"config"}{"git_branch"} $1
Truth table0%0/3
A ||= B
A= $conf->{"config"}{"git_branch"}B= $1
ABresult
1X1
011
000
237 0 ▶ $conf->{'config'}{'git_describe'} ||= $conf->{'config'}{'perl_patchlevel'};
Condition0%0/3
$conf->{"config"}{"git_describe"} ||= $conf->{"config"}{"perl_patchlevel"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$conf->{"config"}{"git_describe"} ||= $conf->{"config"}{"perl_patchlevel"}
$conf->{"config"}{"git_describe"} $conf->{"config"}{"perl_patchlevel"}
Truth table0%0/3
A ||= B
A= $conf->{"config"}{"git_describe"}B= $conf->{"config"}{"perl_patchlevel"}
ABresult
1X1
011
000
238 }
239  
240 83 ▶ $conf->{'config'}{$_} ||= "undef" for grep m{^(?:use|def)} => @config_vars;
Condition100%2/2
$conf->{"config"}{$_} ||= "undef"
l!l
436643
MC/DC100%1/1
$conf->{"config"}{$_} ||= "undef"
$conf->{"config"}{$_}
Truth table100%2/2
A
A= $conf->{"config"}{$_}
Aresult
11
00
241  
242 83 $conf;
243 } # _make_derived
244  
245 75 ▶sub plv2hash {
Subroutine plv2hash: called CC=18 SCAR=29.5
Pod documented
246 75 my %config;
247  
248 75 my $pv = join "\n" => @_;
249  
250 75 ▶ if ($pv =~ m{^Summary of my\s+(\S+)\s+\(\s*(.*?)\s*\)}m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pv =~ /^Summary of my\s+(\S+)\s+\(\s*(.*?)\s*\)/m) 40 35 75
251 40 $config{'package'} = $1;
252 40 my $rev = $2;
253 40 ▶ $rev =~ s/^ revision \s+ (\S+) \s*//x and $config{'revision'} = $1;
Branch: 1 branch
BranchTrueFalseTotal
$rev =~ s/^ revision \s+ (\S+) \s*//x and $config{"revision"} = $1 40 0 40
254 40 ▶ $rev and $config{'version_patchlevel_string'} = $rev;
Branch: 1 branch
BranchTrueFalseTotal
$rev and $config{"version_patchlevel_string"} = $rev 40 0 40
255 40 my ($rel) = $config{'package'} =~ m{perl(\d)};
256 40 my ($vers, $subvers) = $rev =~ m{version\s+(\d+)\s+subversion\s+(\d+)};
257 defined $vers && defined $subvers && defined $rel and
258 40 ▶ $config{'version'} = "$rel.$vers.$subvers";
Branch: 1 branch
BranchTrueFalseTotal
defined $vers and defined $subvers and defined $rel and $config{"version"} = "$rel.$vers.$subvers" 40 0 40
Condition33%2/6
defined $vers and defined $subvers and defined $rel
!ll&&!rl&&r
0040
defined $vers and defined $subvers
!ll&&!rl&&r
0040
MC/DC0%0/3
defined $vers and defined $subvers and defined $rel
defined $vers defined $subvers defined $rel
Truth table25%1/4
A and B and C
A= defined $versB= defined $subversC= defined $rel
ABCresult
0XX0
10X0
1100
1111
259 }
260  
261 75 ▶ if ($pv =~ m{^\s+(Snapshot of:)\s+(\S+)}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pv =~ /^\s+(Snapshot of:)\s+(\S+)/) 0 75 75
262 0 $config{'git_commit_id_title'} = $1;
263 0 $config{'git_commit_id'} = $2;
264 }
265  
266 # these are always last on line and can have multiple quotation styles
267 75 for my $k (qw( ccflags ldflags lddlflags )) {
268 225 ▶ $pv =~ s{, \s* $k \s*=\s* (.*) \s*$}{}mx or next;
Branch: 1 branch
BranchTrueFalseTotal
$pv =~ s/, \s* $k \s*=\s* (.*) \s*$//mx or next 45 180 225
269 45 my $v = $1;
270 45 $v =~ s/\s*,\s*$//;
271 45 $v =~ s/^(['"])(.*)\1$/$2/;
272 45 $config{$k} = $v;
273 }
274  
275 75 my %kv;
276 75 ▶ if ($pv =~ m{\S,? (?:osvers|archname)=}) { # attr is not the first on the line
Branch: 1 branch
BranchTrueFalseTotal
if ($pv =~ /\S,? (?:osvers|archname)=/) { } 15 60 75
277 # up to and including 5.24, a line could have multiple kv pairs
278 15 %kv = ($pv =~ m{\b
279 (\w+) # key
280 \s*= # assign
281 ( '\s*[^']*?\s*' # quoted value
282 | \S+[^=]*?\s*\n # unquoted running till end of line
283 | \S+ # unquoted value
284 | \s*\n # empty
285 )
286 (?:,?\s+|\s*\n)? # optional separator (5.8.x reports did
287 }gx); # not have a ',' between every kv pair)
288 }
289 else {
290 # as of 5.25, each kv pair is listed on its own line
291 60 %kv = ($pv =~ m{^
292 \s+
293 (\w+) # key
294 \s*=\s* # assign
295 (.*?) # value
296 \s*,?\s*$
297 }gmx);
298 }
299  
300 75 ▶ while (my ($k, $v) = each %kv) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %kv) 2316 75 2391
301 2316 $k =~ s{\s+$} {};
302 2316 $v =~ s{\s*\n\z} {};
303 2316 $v =~ s{,$} {};
304 2316 ▶ $v =~ m{^'(.*)'$} and $v = $1;
Branch: 1 branch
BranchTrueFalseTotal
$v =~ /^'(.*)'$/ and $v = $1 674 1642 2316
305 2316 $v =~ s{\s+$} {};
306 2316 $config{$k} = $v;
307 }
308  
309 75 my $build = { %empty_build };
310  
311 $pv =~ m{^\s+Compiled at\s+(.*)}m
312 75 ▶ and $build->{'stamp'} = $1;
Branch: 1 branch
BranchTrueFalseTotal
$pv =~ /^\s+Compiled at\s+(.*)/m and $build->{"stamp"} = $1 39 36 75
313 $pv =~ m{^\s+Locally applied patches:(?:\s+|\n)(.*?)(?:[\s\n]+Buil[td] under)}ms
314 75 ▶ and $build->{'patches'} = [ split m{\n+\s*}, $1 ];
Branch: 1 branch
BranchTrueFalseTotal
$pv =~ /^\s+Locally applied patches:(?:\s+|\n)(.*?)(?:[\s\n]+Buil[td] under)/ms and $build->{"patches"} = [split(/\n+\s*/, $1, 0)] 6 69 75
315 $pv =~ m{^\s+Compile-time options:(?:\s+|\n)(.*?)(?:[\s\n]+(?:Locally applied|Buil[td] under))}ms
316 75 ▶ and map { $build->{'options'}{$_} = 1 } split m{\s+|\n} => $1;
Branch: 1 branch
BranchTrueFalseTotal
$pv =~ /^\s+Compile-time options:(?:\s+|\n)(.*?)(?:[\s\n]+(?:Locally applied|Buil[td] under))/ms and map {$build->{"options"}{$_} = 1;} split(/\s+|\n/, $1, 0) 39 36 75
317  
318 75 $build->{'osname'} = $config{'osname'};
319 $pv =~ m{^\s+Built under\s+(.*)}m
320 75 ▶ and $build->{'osname'} = $1;
Branch: 1 branch
BranchTrueFalseTotal
$pv =~ /^\s+Built under\s+(.*)/m and $build->{"osname"} = $1 39 36 75
321 75 ▶ $config{'osname'} ||= $build->{'osname'};
Condition66%2/3
$config{"osname"} ||= $build->{"osname"}
l!l&&r!l&&!r
40035
MC/DC50%1/2
$config{"osname"} ||= $build->{"osname"}
$config{"osname"} $build->{"osname"}
Truth table66%2/3
A ||= B
A= $config{"osname"}B= $build->{"osname"}
ABresult
1X1
011
000
322  
323 75 return _make_derived ({
324 'build' => $build,
325 'environment' => {},
326 'config' => \%config,
327 'derived' => {},
328 'inc' => [],
329 });
330 } # plv2hash
331  
332 64 ▶sub summary {
Subroutine summary: called CC=9 SCAR=22.0
Pod documented
333 64 ▶ my $conf = shift || myconfig ();
Condition66%2/3
shift() || myconfig()
l!l&&r!l&&!r
6130
MC/DC0%0/2
shift() || myconfig()
shift() myconfig()
Truth table66%2/3
A || B
A= shift()B= myconfig()
ABresult
1X1
011
000
334 ref $conf eq "HASH"
335 && exists $conf->{'config'}
336 && exists $conf->{'build'}
337 && ref $conf->{'config'} eq "HASH"
338 64 ▶ && ref $conf->{'build'} eq "HASH" or return;
Branch: 1 branch
BranchTrueFalseTotal
ref $conf eq "HASH" and exists $conf->{"config"} and exists $conf->{"build"} and ref $conf->{"config"} eq "HASH" and ref $conf->{"build"} eq "HASH" or return 60 4 64
Condition91%11/12
ref $conf eq "HASH" and exists $conf->{"config"} and exists $conf->{"build"} and ref $conf->{"config"} eq "HASH" and ref $conf->{"build"} eq "HASH"
!ll&&!rl&&r
3160
ref $conf eq "HASH" and exists $conf->{"config"} and exists $conf->{"build"} and ref $conf->{"config"} eq "HASH"
!ll&&!rl&&r
2161
ref $conf eq "HASH" and exists $conf->{"config"} and exists $conf->{"build"}
!ll&&!rl&&r
1162
ref $conf eq "HASH" and exists $conf->{"config"}
!ll&&!rl&&r
0163
MC/DC80%4/5
ref $conf eq "HASH" and exists $conf->{"config"} and exists $conf->{"build"} and ref $conf->{"config"} eq "HASH" and ref $conf->{"build"} eq "HASH"
ref $conf eq "HASH" exists $conf->{"config"} exists $conf->{"build"} ref $conf->{"config"} eq "HASH" ref $conf->{"build"} eq "HASH"
Truth table83%5/6
A and B and C and D and E
A= ref $conf eq "HASH"B= exists $conf->{"config"}C= exists $conf->{"build"}D= ref $conf->{"config"} eq "HASH"E= ref $conf->{"build"} eq "HASH"
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
339  
340 my %info = map {
341 60 ▶ exists $conf->{'config'}{$_} ? ( $_ => $conf->{'config'}{$_} ) : () }
Branch: 1 branch
BranchTrueFalseTotal
exists $conf->{'config'}{$_} ? : 1688 112 1800
342 qw( archname osname osvers revision patchlevel subversion version
343 cc ccversion gccversion config_args inc_version_list
344 d_longdbl d_longlong use64bitall use64bitint useithreads
345 uselongdouble usemultiplicity usemymalloc useperlio useshrplib
346 doublesize intsize ivsize nvsize longdblsize longlongsize lseeksize
347 default_inc_excludes_dot
348 );
349 60 $info{$_}++ for grep { $conf->{'build'}{'options'}{$_} } keys %{$conf->{'build'}{'options'}};
350  
351 60 return \%info;
352 } # summary
353  
354 41 ▶sub signature {
Subroutine signature: called CC=4 SCAR=13.9
Pod documented
355 41 my $no_md5 = "0" x 32;
356 41 ▶ my $conf = summary (shift) or return $no_md5;
Branch: 1 branch
BranchTrueFalseTotal
my $conf = summary(shift()) or return $no_md5 37 4 41
357  
358 37 eval { require Digest::MD5 };
359 37 ▶ $@ and return $no_md5;
Branch: 1 branch
BranchTrueFalseTotal
$@ and return $no_md5 1 36 37
360  
361 36 $conf->{'cc'} =~ s{.*\bccache\s+}{};
362 36 $conf->{'cc'} =~ s{.*[/\\]}{};
363  
364 36 delete $conf->{'config_args'};
365 return Digest::MD5::md5_hex (join "\xFF" => map {
366 995 ▶ "$_=".(defined $conf->{$_} ? $conf->{$_} : "\xFE");
Branch: 1 branch
BranchTrueFalseTotal
defined $conf->{$_} ? : 995 0 995
367 36 } sort keys %{$conf});
368 } # signature
369  
370 8 ▶sub myconfig {
Subroutine myconfig: called CC=8 SCAR=20.8
Pod documented
371 8 my $args = shift;
372 1 ▶ my %args = ref $args eq "HASH" ? %{$args} :
Branch: 1 branch
BranchTrueFalseTotal
ref $args eq 'ARRAY' ? : 1 6 7
373 8 ▶ ref $args eq "ARRAY" ? @{$args} : ();
Branch: 1 branch
BranchTrueFalseTotal
ref $args eq 'HASH' ? : 1 7 8
374  
375 8 my $build = { %empty_build };
376  
377 # 5.14.0 and later provide all the information without shelling out
378 8 my $stamp = eval { Config::compile_date () };
379 8 ▶ if (defined $stamp) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $stamp) { } 3 5 8
380 3 $stamp =~ s/^Compiled at //;
381 3 $build->{'osname'} = $^O;
382 3 $build->{'stamp'} = $stamp;
383 3 $build->{'patches'} = [ Config::local_patches () ];
384 3 $build->{'options'}{$_} = 1 for Config::bincompat_options (),
385 Config::non_bincompat_options ();
386 }
387 else {
388 #y $pv = qx[$^X -e"sub Config::myconfig{};" -V];
389 5 my $cnf = plv2hash (qx[$^X -V]);
390  
391 5 $build->{$_} = $cnf->{'build'}{$_} for qw( osname stamp patches options );
392 }
393  
394 8 my @KEYS = keys %ENV;
395 my %env =
396 8 map {( $_ => $ENV{$_} )} grep m{^PERL} => @KEYS;
397 8 ▶ if ($args{'env'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"env"}) 2 6 8
398 2 $env{$_} = $ENV{$_} for grep m{$args{'env'}} => @KEYS;
399 }
400  
401 8 my %config = map { $_ => $Config{$_} } @config_vars;
402  
403 8 return _make_derived ({
404 'build' => $build,
405 'environment' => \%env,
406 'config' => \%config,
407 'derived' => {},
408 'inc' => \@INC,
409 });
410 } # myconfig
411  
412 36 1;
413  
414 __END__
↑ Summary /dev/null »