Inline/Module.pm

filter: Statementstmt 17.1% 40 / 233 Branchbran 4.4% 4 / 90 Conditioncond 3.7% 1 / 27 MC/DCmcdc 0.0% 0 / 15 Subroutinesub 31.4% 11 / 35 Podpod 4.7% 1 / 21 totaltotal 13.5% 57 / 421 CC 62 SCAR 32.9
CC
62
Cov
13%
default_meta
72.0
postamble
56.0
write_module
42.0
CRAP 26.9
↑ Summary auto/share/dist/Inline-Module/CPPConfig.pm »
1 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Inline::Module;
3 1 our $VERSION = '0.34';
4 1 our $API_VERSION = 'v2';
5  
6 1 ▶use Carp 'croak';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Config();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use File::Find();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use File::Path();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use File::Spec();
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 my $inline_build_path = '.inline';
13  
14 1 ▶use constant DEBUG_ON => $ENV{PERL_INLINE_MODULE_DEBUG} ? 1 : 0;
Subroutine BEGIN: called CC=2 SCAR=7.1
Branch: 1 branch
BranchTrueFalseTotal
$ENV{'PERL_INLINE_MODULE_DEBUG'} ? : 0 1 1
15 0 ▶sub DEBUG { if (DEBUG_ON) { print "DEBUG >>> ", sprintf(shift, @_), "\n" }}
Subroutine DEBUG: not called CC=1 SCAR=6.9
Pod undocumented
16  
17 #------------------------------------------------------------------------------
18 # This import serves multiple roles:
19 # - ::Inline module's proxy to Inline.pm
20 # - Makefile.PL postamble
21 # - Makefile rule support
22 #------------------------------------------------------------------------------
23 sub import {
24 1 ▶ my $class = shift;
Subroutine import: called CC=10 SCAR=37.1
25 1 DEBUG_ON && DEBUG "$class->import(@_)";
26  
27 1 my ($stub_module, $program) = caller;
28 1 $program =~ s!.*[\\\/]!!;
29  
30 1 ▶ if ($program eq "Makefile.PL" and not -e 'INLINE.h') {
Branch: 2 branches
BranchTrueFalseTotal
if ($program eq 'Makefile.PL' and not -e 'INLINE.h') { } 0 1 1
elsif ($program eq 'Build.PL') { } 0 1 1
Condition33%1/3
$program eq "Makefile.PL" and not -e "INLINE.h"
!ll&&!rl&&r
100
MC/DC0%0/2
$program eq "Makefile.PL" and not -e "INLINE.h"
$program eq "Makefile.PL" not -e "INLINE.h"
Truth table33%1/3
A and not(B)
A= $program eq "Makefile.PL"B= not -e "INLINE.h"
ABresult
0X0
100
111
31 0 $class->check_inc_inc($program);
32 1 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
33 0 *MY::postamble = \&postamble;
34 0 return;
35 }
36 elsif ($program eq 'Build.PL') {
37 0 $class->check_inc_inc($program);
38 0 return;
39 }
40  
41 1 ▶ return unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 1 0 1
42 0 my $cmd = shift;
43  
44 0 ▶ return $class->handle_stub($stub_module, @_)
Branch: 1 branch
BranchTrueFalseTotal
if $cmd eq "stub" 0 0 0
45 if $cmd eq 'stub';
46 0 ▶ return $class->handle_makestub(@_)
Branch: 1 branch
BranchTrueFalseTotal
if $cmd eq "makestub" 0 0 0
47 if $cmd eq 'makestub';
48 0 ▶ return $class->handle_distdir(@ARGV)
Branch: 1 branch
BranchTrueFalseTotal
if $cmd eq "distdir" 0 0 0
49 if $cmd eq 'distdir';
50 0 ▶ return $class->handle_fixblib()
Branch: 1 branch
BranchTrueFalseTotal
if $cmd eq "fixblib" 0 0 0
51 if $cmd eq 'fixblib';
52  
53 # TODO: Deprecated 12/26/2014. Remove this in a month.
54 0 ▶ die "Inline::Module 'autostub' no longer supported. " .
Branch: 1 branch
BranchTrueFalseTotal
if $cmd eq "autostub" 0 0 0
55 "Remove this option from PERL5OPT."
56 if $cmd eq 'autostub';
57  
58 0 die "Unknown Inline::Module::import argument '$cmd'"
59 }
60  
61 sub check_api_version {
62 0 ▶ my ($class, $stub_module, $api_version) = @_;
Subroutine check_api_version: not called CC=2 SCAR=17.9
Pod undocumented
63 0 ▶ if ($api_version ne $API_VERSION) {
Branch: 1 branch
BranchTrueFalseTotal
if ($api_version ne $Inline::Module::API_VERSION) 0 0 0
64 0 warn <<"...";
65 It seems that '$stub_module' is out of date.
66 It is using Inline::Module API version '$api_version'.
67 You have Inline::Module API version '$API_VERSION' installed.
68  
69 Make sure you have the latest version of Inline::Module installed, then run:
70  
71 perl -MInline::Module=makestub,$stub_module
72  
73 ...
74 # XXX 'exit' is used to get a cleaner error msg.
75 # Try to redo this without 'exit'.
76 0 exit 1;
77 }
78 }
79  
80 sub check_inc_inc {
81 0 ▶ my ($class, $program) = @_;
Subroutine check_inc_inc: not called CC=3 SCAR=24.8
Pod undocumented
82 0 ▶ my $first = $INC[0] or die;
Branch: 1 branch
BranchTrueFalseTotal
my $first = $INC[0] or die 0 0 0
83 0 ▶ if ($first !~ /^(\.[\/\\])?inc[\/\\]?$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $first =~ m(^(\.[/\\])?inc[/\\]?$)) 0 0 0
84 0 die <<"...";
85 First element of \@INC should be 'inc'.
86 It's '$first'.
87 Add this line to the top of your '$program':
88  
89 use lib 'inc';
90  
91 ...
92 }
93 }
94  
95 sub importer {
96 0 ▶ my ($class, $stub_module) = @_;
Subroutine importer: not called CC=1 SCAR=6.9
Pod undocumented
97 return sub {
98 0 ▶ my ($class, $lang) = @_;
Subroutine __ANON__: not called CC=4 SCAR=30.0
99 0 ▶ return unless defined $lang;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $lang 0 0 0
100 0 require File::Path;
101 0 ▶ File::Path::mkpath($inline_build_path)
Branch: 1 branch
BranchTrueFalseTotal
unless -d $inline_build_path 0 0 0
102 unless -d $inline_build_path;
103 0 require Inline;
104 0 ▶ Inline->import(
Branch: 1 branch
BranchTrueFalseTotal
$lang eq 'C' ? : 0 0 0
105 Config =>
106 directory => $inline_build_path,
107 ($lang eq 'C') ? (using => 'Inline::C::Parser::RegExp') : (),
108 name => $stub_module,
109 CLEAN_AFTER_BUILD => 0,
110 );
111 0 shift(@_);
112 0 DEBUG_ON && DEBUG "Inline::Module::importer proxy to Inline::%s", @_;
113 0 Inline->import_heavy(@_);
114 0 };
115 }
116  
117 #------------------------------------------------------------------------------
118 # The postamble method:
119 #------------------------------------------------------------------------------
120 sub postamble {
121 0 ▶ my ($makemaker, %args) = @_;
Subroutine postamble: not called CC=7 SCAR=40.3
Pod documented
122 0 DEBUG_ON && DEBUG "Inline::Module::postamble(${\join', ',@_})";
123  
124 my $meta = $args{inline}
125 0 ▶ or croak "'postamble' section requires 'inline' key in Makefile.PL";
Branch: 1 branch
BranchTrueFalseTotal
my $meta = $args{"inline"} or croak("'postamble' section requires 'inline' key in Makefile.PL") 0 0 0
126 croak "postamble 'inline' section requires 'module' key in Makefile.PL"
127 0 ▶ unless $meta->{module};
Branch: 1 branch
BranchTrueFalseTotal
unless $meta->{"module"} 0 0 0
128  
129 0 my $class = __PACKAGE__;
130 0 $class->default_meta($meta);
131  
132 0 my $code_modules = $meta->{module};
133 0 my $stub_modules = $meta->{stub};
134 0 my $included_modules = $class->included_modules($meta);
135  
136 0 ▶ if ($meta->{makestub} and not -e 'inc' and not -e 'INLINE.h') {
Branch: 1 branch
BranchTrueFalseTotal
if ($meta->{"makestub"} and not -e "inc" and not -e "INLINE.h") 0 0 0
Condition0%0/6
$meta->{"makestub"} and not -e "inc" and not -e "INLINE.h"
!ll&&!rl&&r
000
$meta->{"makestub"} and not -e "inc"
!ll&&!rl&&r
000
MC/DC0%0/3
$meta->{"makestub"} and not -e "inc" and not -e "INLINE.h"
$meta->{"makestub"} not -e "inc" not -e "INLINE.h"
Truth table0%0/4
A and not(B) and not(C)
A= $meta->{"makestub"}B= not -e "inc"C= not -e "INLINE.h"
ABCresult
0XX0
10X0
1100
1111
137 0 $class->make_stub_modules(@{$meta->{stub}});
138 }
139  
140 0 my $section = <<"...";
141 clean ::
142 \t- \$(RM_RF) $inline_build_path
143  
144 distdir : distdir_inline
145  
146 distdir_inline : create_distdir
147 \t\$(NOECHO) \$(ABSPERLRUN) -MInline::Module=distdir -e 1 -- \$(DISTVNAME) @$stub_modules -- @$included_modules
148  
149 pure_all ::
150 ...
151 0 for my $module (@$code_modules) {
152 0 $section .=
153 "\t\$(NOECHO) \$(ABSPERLRUN) -Iinc -Ilib -M$module -e 1 --\n";
154 }
155 $section .=
156 0 "\t\$(NOECHO) \$(ABSPERLRUN) -Iinc -MInline::Module=fixblib -e 1 --\n";
157  
158 0 return $section;
159 }
160  
161 #------------------------------------------------------------------------------
162 # The handle methods.
163 #------------------------------------------------------------------------------
164 sub handle_stub {
165 0 ▶ my ($class, $stub_module, $api_version) = @_;
Subroutine handle_stub: not called CC=1 SCAR=2.6
Pod undocumented
166 0 DEBUG_ON && DEBUG "$class->handle_stub($stub_module, $api_version)";
167 0 $class->check_api_version($stub_module, $api_version);
168 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
169 0 *{"${stub_module}::import"} = $class->importer($stub_module);
170 0 return;
171 }
172  
173 sub handle_makestub {
174 0 ▶ my ($class, @args) = @_;
Subroutine handle_makestub: not called CC=3 SCAR=24.8
Pod undocumented
175 0 DEBUG_ON && DEBUG "$class->handle_makestub(${\join', ',@args})";
176  
177 0 my @modules;
178 0 for my $arg (@args) {
179 0 ▶ if ($arg =~ /::/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg =~ /::/) { } 0 0 0
180 0 push @modules, $arg;
181 }
182 else {
183 0 croak "Unknown 'makestub' argument: '$arg'";
184 }
185 }
186  
187 0 $class->make_stub_modules(@modules);
188  
189 0 exit 0;
190 }
191  
192 sub handle_distdir {
193 0 ▶ my ($class, $distdir, @args) = @_;
Subroutine handle_distdir: not called CC=5 SCAR=34.0
Pod undocumented
194 0 DEBUG_ON && DEBUG "$class->handle_distdir($distdir, ${\join', ',@args})";
195 0 my $stub_modules = [];
196 0 my $included_modules = [];
197  
198 0 ▶ while (@args and ($_ = shift(@args)) ne '--') {
Branch: 1 branch
BranchTrueFalseTotal
if (@args and ($_ = shift @args) ne "--") 0 0 0
Condition0%0/3
@args and ($_ = shift @args) ne "--"
!ll&&!rl&&r
000
MC/DC0%0/2
@args and ($_ = shift @args) ne "--"
@args ($_ = shift @args) ne "--"
Truth table0%0/3
A and B
A= @argsB= ($_ = shift @args) ne "--"
ABresult
0X0
100
111
199 0 push @$stub_modules, $_;
200 }
201 0 ▶ while (@args and ($_ = shift(@args)) ne '--') {
Branch: 1 branch
BranchTrueFalseTotal
if (@args and ($_ = shift @args) ne "--") 0 0 0
Condition0%0/3
@args and ($_ = shift @args) ne "--"
!ll&&!rl&&r
000
MC/DC0%0/2
@args and ($_ = shift @args) ne "--"
@args ($_ = shift @args) ne "--"
Truth table0%0/3
A and B
A= @argsB= ($_ = shift @args) ne "--"
ABresult
0X0
100
111
202 0 push @$included_modules, $_;
203 }
204 0 $class->add_to_distdir($distdir, $stub_modules, $included_modules);
205 }
206  
207 sub handle_fixblib {
208 0 ▶ my ($class) = @_;
Subroutine handle_fixblib: not called CC=2 SCAR=17.9
Pod undocumented
209 0 DEBUG_ON && DEBUG "$class->handle_fixblib()";
210 0 my $ext = $Config::Config{dlext};
211 0 ▶ -d 'blib'
Branch: 1 branch
BranchTrueFalseTotal
-d "blib" or die "Inline::Module::fixblib expected to find 'blib' directory" 0 0 0
212 or die "Inline::Module::fixblib expected to find 'blib' directory";
213 File::Find::find({
214 wanted => sub {
215 0 ▶ -f or return;
Subroutine __ANON__: not called CC=5 SCAR=34.0
Branch: 1 branch
BranchTrueFalseTotal
-f $_ or return 0 0 0
216 0 ▶ if (m!^($inline_build_path/lib/auto/.*)\.$ext$!) {
Branch: 1 branch
BranchTrueFalseTotal
if (m[^($inline_build_path/lib/auto/.*)\.$ext$]) 0 0 0
217 0 my $blib_ext = $_;
218 0 ▶ $blib_ext =~ s!^$inline_build_path/lib!blib/arch! or die;
Branch: 1 branch
BranchTrueFalseTotal
$blib_ext =~ s[^$inline_build_path/lib][blib/arch] or die 0 0 0
219 0 my $blib_ext_dir = $blib_ext;
220 0 ▶ $blib_ext_dir =~ s!(.*)/.*!$1! or die;
Branch: 1 branch
BranchTrueFalseTotal
$blib_ext_dir =~ s[(.*)/.*][$1] or die 0 0 0
221 0 File::Path::mkpath $blib_ext_dir;
222 0 link $_, $blib_ext;
223 }
224 },
225 0 no_chdir => 1,
226 }, $inline_build_path);
227 }
228  
229 #------------------------------------------------------------------------------
230 # Worker methods.
231 #------------------------------------------------------------------------------
232 sub default_meta {
233 0 ▶ my ($class, $meta) = @_;
Subroutine default_meta: not called CC=8 SCAR=42.8
Pod undocumented
234 defined $meta->{module}
235 0 ▶ or die "Meta 'module' not defined";
Branch: 1 branch
BranchTrueFalseTotal
defined $meta->{"module"} or die "Meta 'module' not defined" 0 0 0
236 0 ▶ $meta->{module} = [ $meta->{module} ] unless ref $meta->{module};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $meta->{"module"} 0 0 0
237 0 ▶ $meta->{stub} ||= [ map "${_}::Inline", @{$meta->{module}} ];
Condition0%0/2
$meta->{"stub"} ||= [map(("${_}::Inline"), @{$$meta{"module"};})]
l!l
00
MC/DC0%0/1
$meta->{"stub"} ||= [map(("${_}::Inline"), @{$$meta{"module"};})]
$meta->{"stub"}
Truth table0%0/2
A
A= $meta->{"stub"}
Aresult
11
00
238 0 ▶ $meta->{stub} = [ $meta->{stub} ] unless ref $meta->{stub};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $meta->{"stub"} 0 0 0
239 0 ▶ $meta->{ilsm} ||= 'Inline::C';
Condition0%0/2
$meta->{"ilsm"} ||= "Inline::C"
l!l
00
MC/DC0%0/1
$meta->{"ilsm"} ||= "Inline::C"
$meta->{"ilsm"}
Truth table0%0/2
A
A= $meta->{"ilsm"}
Aresult
11
00
240 0 ▶ $meta->{ilsm} = [ $meta->{ilsm} ] unless ref $meta->{ilsm};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $meta->{"ilsm"} 0 0 0
241 0 ▶ $meta->{bundle} = 1 unless defined $meta->{bundle};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $meta->{"bundle"} 0 0 0
242 }
243  
244 sub included_modules {
245 0 ▶ my ($class, $meta) = @_;
Subroutine included_modules: not called CC=5 SCAR=34.0
Pod undocumented
246 0 DEBUG_ON && DEBUG "$class->included_modules($meta)";
247 0 ▶ return [] if not $meta->{bundle};
Branch: 1 branch
BranchTrueFalseTotal
unless $meta->{"bundle"} 0 0 0
248 0 my $ilsm = $meta->{ilsm};
249 0 my $include = [
250 'Inline',
251 'Inline::denter',
252 'Inline::Module',
253 @$ilsm,
254 ];
255 0 ▶ if (caller eq 'Module::Build::InlineModule') {
Branch: 1 branch
BranchTrueFalseTotal
if (caller eq "Module::Build::InlineModule") 0 0 0
256 0 push @$include, 'Module::Build::InlineModule';
257 }
258 0 ▶ if (grep /:C$/, @$ilsm) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep /:C$/, @$ilsm) 0 0 0
259 0 push @$include,
260 'Inline::C::Parser::RegExp';
261 }
262 0 ▶ if (grep /:CPP$/, @$ilsm) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep /:CPP$/, @$ilsm) 0 0 0
263 0 push @$include, (
264 'Inline::C',
265 'Inline::CPP::Config',
266 'Inline::CPP::Parser::RecDescent',
267 'Parse::RecDescent',
268 'ExtUtils::CppGuess',
269 'Capture::Tiny',
270 );
271 }
272 0 return $include;
273 }
274  
275 sub add_to_distdir {
276 0 ▶ my ($class, $distdir, $stub_modules, $included_modules) = @_;
Subroutine add_to_distdir: not called CC=5 SCAR=34.0
Pod undocumented
277 0 DEBUG_ON && DEBUG "$class->add_to_distdir($distdir) [@$stub_modules] [@$included_modules]";
278 0 my $manifest = []; # files created under distdir
279 0 for my $module (@$stub_modules) {
280 0 my $code = $class->dyna_module($module);
281 0 $class->write_module("$distdir/lib", $module, $code);
282 0 $code = $class->proxy_module($module);
283 0 $class->write_module("$distdir/inc", $module, $code);
284 0 $module =~ s!::!/!g;
285 0 ▶ push @$manifest, "lib/$module.pm"
Branch: 1 branch
BranchTrueFalseTotal
unless -e "lib/$module.pm" 0 0 0
286 unless -e "lib/$module.pm";
287 0 push @$manifest, "inc/$module.pm";
288 }
289 0 for my $module (@$included_modules) {
290 0 ▶ my $code = $module eq 'Inline::CPP::Config'
Branch: 1 branch
BranchTrueFalseTotal
$module eq 'Inline::CPP::Config' ? : 0 0 0
291 ? $class->read_share_cpp_config
292 : $class->read_local_module($module);
293 0 $class->write_module("$distdir/inc", $module, $code);
294 0 $module =~ s!::!/!g;
295 0 push @$manifest, "inc/$module.pm";
296 }
297  
298 0 $class->add_to_manifest($distdir, @$manifest);
299  
300 0 return $manifest; # return a list of the files added
301 }
302  
303 sub make_stub_modules {
304 0 ▶ my ($class, @modules) = @_;
Subroutine make_stub_modules: not called CC=3 SCAR=24.8
Pod undocumented
305 0 DEBUG_ON && DEBUG "$class->make_stub_modules(@modules)";
306  
307 0 for my $module (@modules) {
308 0 my $code = $class->proxy_module($module);
309 0 my $path = $class->write_module('lib', $module, $code, 'onchange');
310 0 ▶ if ($path) {
Branch: 1 branch
BranchTrueFalseTotal
if ($path) 0 0 0
311 0 print "Created stub module '$path' (Inline::Module $VERSION)\n";
312 }
313 }
314 }
315  
316 sub read_local_module {
317 0 ▶ my ($class, $module) = @_;
Subroutine read_local_module: not called CC=2 SCAR=17.9
Pod undocumented
318 0 ▶ eval "require $module; 1" or die $@;
Branch: 1 branch
BranchTrueFalseTotal
eval "require $module; 1" or die $@ 0 0 0
319 0 my $file = $module;
320 0 $file =~ s!::!/!g;
321 0 $class->read_file($INC{"$file.pm"});
322 }
323  
324 sub read_share_cpp_config {
325 0 ▶ my ($class) = @_;
Subroutine read_share_cpp_config: not called CC=1 SCAR=6.9
Pod undocumented
326 0 require File::Share;
327 0 my $dir = File::Share::dist_dir('Inline-Module');
328 0 my $path = File::Spec->catfile($dir, 'CPPConfig.pm');
329 0 $class->read_file($path);
330 }
331  
332 sub proxy_module {
333 0 ▶ my ($class, $module) = @_;
Subroutine proxy_module: not called CC=1 SCAR=6.9
Pod undocumented
334 0 DEBUG_ON && DEBUG "$class->proxy_module($module)";
335  
336 0 return <<"...";
337 # DO NOT EDIT. GENERATED BY: Inline::Module
338 #
339 # This module is for author-side development only. When this module is shipped
340 # to CPAN, it will be automagically replaced with content that does not
341 # require any Inline framework modules (or any other non-core modules).
342 #
343 # To regenerate this stub module, run this command:
344 #
345 # perl -MInline::Module=makestub,$module
346  
347 use strict; use warnings;
348 package $module;
349 use Inline::Module stub => '$API_VERSION';
350 1;
351 ...
352 }
353  
354 sub dyna_module {
355 0 ▶ my ($class, $module) = @_;
Subroutine dyna_module: not called CC=1 SCAR=6.9
Pod undocumented
356 0 DEBUG_ON && DEBUG "$class->dyna_module($module)";
357 0 return <<"...";
358 # DO NOT EDIT. GENERATED BY: Inline::Module $Inline::Module::VERSION
359  
360 use strict; use warnings;
361 package $module;
362 use base 'DynaLoader';
363 bootstrap $module;
364 1;
365 ...
366  
367 # TODO: Add XS VERSION checking support:
368 # our \$VERSION = '0.0.5';
369 # bootstrap $module \$VERSION;
370 }
371  
372 sub read_file {
373 0 ▶ my ($class, $filepath) = @_;
Subroutine read_file: not called CC=2 SCAR=17.9
Pod undocumented
374 0 DEBUG_ON && DEBUG "$class->read_file($filepath)";
375 0 ▶ open IN, '<', $filepath
Branch: 1 branch
BranchTrueFalseTotal
open IN, "<", $filepath or die "Can't open '${filepath}' for input:\n$!" 0 0 0
376 or die "Can't open '$filepath' for input:\n$!";
377 0 my $code = do {local $/; <IN>};
378 0 close IN;
379 0 return $code;
380 }
381  
382 sub write_module {
383 0 ▶ my $class = shift;
Subroutine write_module: not called CC=6 SCAR=37.4
Pod undocumented
384 0 my ($dest, $module, $code, $onchange) = @_;
385 0 DEBUG_ON && DEBUG "$class->write_module($dest, $module, ..., $onchange)";
386 0 ▶ $onchange ||= 0;
Condition0%0/2
$onchange ||= 0
l!l
00
MC/DC0%0/1
$onchange ||= 0
$onchange
Truth table0%0/2
A
A= $onchange
Aresult
11
00
387  
388 0 $code =~ s/\n+__END__\n.*//s;
389  
390 0 my $filepath = $module;
391 0 $filepath =~ s!::!/!g;
392 0 $filepath = "$dest/$filepath.pm";
393 0 my $dirpath = $filepath;
394 0 $dirpath =~ s!(.*)/.*!$1!;
395 0 File::Path::mkpath($dirpath);
396  
397 0 ▶ return if $onchange and
Branch: 1 branch
BranchTrueFalseTotal
if $onchange and -e $filepath and $class->read_file($filepath) eq $code 0 0 0
Condition0%0/6
$onchange and -e $filepath and $class->read_file($filepath) eq $code
!ll&&!rl&&r
000
$onchange and -e $filepath
!ll&&!rl&&r
000
MC/DC0%0/3
$onchange and -e $filepath and $class->read_file($filepath) eq $code
$onchange -e $filepath $class->read_file($filepath) eq $code
Truth table0%0/4
A and B and C
A= $onchangeB= -e $filepathC= $class->read_file($filepath) eq $code
ABCresult
0XX0
10X0
1100
1111
398 -e $filepath and
399 $class->read_file($filepath) eq $code;
400  
401 0 unlink $filepath;
402 0 ▶ open OUT, '>', $filepath
Branch: 1 branch
BranchTrueFalseTotal
open OUT, ">", $filepath or die "Can't open '${filepath}' for output:\n$!" 0 0 0
403 or die "Can't open '$filepath' for output:\n$!";
404 0 print OUT $code;
405 0 close OUT;
406  
407 0 return $filepath;
408 }
409  
410 sub add_to_manifest {
411 0 ▶ my ($class, $distdir, @files) = @_;
Subroutine add_to_manifest: not called CC=4 SCAR=30.0
Pod undocumented
412 0 DEBUG_ON && DEBUG "$class->add_to_manifest($distdir) (@files)";
413 0 my $manifest = "$distdir/MANIFEST";
414  
415 0 ▶ if (-w $manifest) {
Branch: 1 branch
BranchTrueFalseTotal
if (-w $manifest) 0 0 0
416 0 ▶ open my $out, '>>', $manifest
Branch: 1 branch
BranchTrueFalseTotal
open my $out, ">>", $manifest or die "Can't open '${manifest}' for append:\n$!" 0 0 0
417 or die "Can't open '$manifest' for append:\n$!";
418 0 for my $file (@files) {
419 0 print $out "$file\n";
420 }
421 0 close $out;
422 }
423 }
424  
425 sub smoke_system_info_dump {
426 0 ▶ my ($class, @msg) = @_;
Subroutine smoke_system_info_dump: not called CC=1 SCAR=6.9
Pod undocumented
427 0 my $msg = sprintf(@msg);
428 0 chomp $msg;
429 0 require Data::Dumper;
430 0 local $Data::Dumper::Sortkeys = 1;
431 0 local $Data::Dumper::Terse = 1;
432 0 local $Data::Dumper::Indent = 1;
433  
434 0 my @path_files;
435 File::Find::find({
436 wanted => sub {
437 0 ▶ push @path_files, $File::Find::name if -f;
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if -f $_ 0 0 0
438 },
439 0 }, File::Spec->path());
440 0 my $dump = Data::Dumper::Dumper(
441 {
442 'ENV' => \%ENV,
443 'Config' => \%Config::Config,
444 'Path Files' => \@path_files,
445 },
446 );
447 0 Carp::confess <<"..."
448 Error: $msg
449  
450 System Data:
451 $dump
452  
453 Error: $msg
454 ...
455 }
456  
457 1 1;
↑ Summary auto/share/dist/Inline-Module/CPPConfig.pm »