Inline/Module.pm

filter: Statementstmt 18.2% 40 / 219 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 14.0% 57 / 407 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.33';
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(@_), "\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 "Inline::Module::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  
123 my $meta = $args{inline}
124 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
125 croak "postamble 'inline' section requires 'module' key in Makefile.PL"
126 0 ▶ unless $meta->{module};
Branch: 1 branch
BranchTrueFalseTotal
unless $meta->{"module"} 0 0 0
127  
128 0 my $class = __PACKAGE__;
129 0 $class->default_meta($meta);
130  
131 0 my $code_modules = $meta->{module};
132 0 my $stub_modules = $meta->{stub};
133 0 my $included_modules = $class->included_modules($meta);
134  
135 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
136 0 $class->make_stub_modules(@{$meta->{stub}});
137 }
138  
139 0 my $section = <<"...";
140 clean ::
141 \t- \$(RM_RF) $inline_build_path
142  
143 distdir : distdir_inline
144  
145 distdir_inline : create_distdir
146 \t\$(NOECHO) \$(ABSPERLRUN) -MInline::Module=distdir -e 1 -- \$(DISTVNAME) @$stub_modules -- @$included_modules
147  
148 pure_all ::
149 ...
150 0 for my $module (@$code_modules) {
151 0 $section .=
152 "\t\$(NOECHO) \$(ABSPERLRUN) -Iinc -Ilib -M$module -e 1 --\n";
153 }
154 $section .=
155 0 "\t\$(NOECHO) \$(ABSPERLRUN) -Iinc -MInline::Module=fixblib -e 1 --\n";
156  
157 0 return $section;
158 }
159  
160 #------------------------------------------------------------------------------
161 # The handle methods.
162 #------------------------------------------------------------------------------
163 sub handle_stub {
164 0 ▶ my ($class, $stub_module, $api_version) = @_;
Subroutine handle_stub: not called CC=1 SCAR=2.2
Pod undocumented
165 0 $class->check_api_version($stub_module, $api_version);
166 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
167 0 *{"${stub_module}::import"} = $class->importer($stub_module);
168 0 return;
169 }
170  
171 sub handle_makestub {
172 0 ▶ my ($class, @args) = @_;
Subroutine handle_makestub: not called CC=3 SCAR=24.8
Pod undocumented
173  
174 0 my @modules;
175 0 for my $arg (@args) {
176 0 ▶ if ($arg =~ /::/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg =~ /::/) { } 0 0 0
177 0 push @modules, $arg;
178 }
179 else {
180 0 croak "Unknown 'makestub' argument: '$arg'";
181 }
182 }
183  
184 0 $class->make_stub_modules(@modules);
185  
186 0 exit 0;
187 }
188  
189 sub handle_distdir {
190 0 ▶ my ($class, $distdir, @args) = @_;
Subroutine handle_distdir: not called CC=5 SCAR=34.0
Pod undocumented
191 0 my $stub_modules = [];
192 0 my $included_modules = [];
193  
194 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
195 0 push @$stub_modules, $_;
196 }
197 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
198 0 push @$included_modules, $_;
199 }
200 0 $class->add_to_distdir($distdir, $stub_modules, $included_modules);
201 }
202  
203 sub handle_fixblib {
204 0 ▶ my ($class) = @_;
Subroutine handle_fixblib: not called CC=2 SCAR=17.9
Pod undocumented
205 0 my $ext = $Config::Config{dlext};
206 0 ▶ -d 'blib'
Branch: 1 branch
BranchTrueFalseTotal
-d "blib" or die "Inline::Module::fixblib expected to find 'blib' directory" 0 0 0
207 or die "Inline::Module::fixblib expected to find 'blib' directory";
208 File::Find::find({
209 wanted => sub {
210 0 ▶ -f or return;
Subroutine __ANON__: not called CC=5 SCAR=34.0
Branch: 1 branch
BranchTrueFalseTotal
-f $_ or return 0 0 0
211 0 ▶ if (m!^($inline_build_path/lib/auto/.*)\.$ext$!) {
Branch: 1 branch
BranchTrueFalseTotal
if (m[^($inline_build_path/lib/auto/.*)\.$ext$]) 0 0 0
212 0 my $blib_ext = $_;
213 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
214 0 my $blib_ext_dir = $blib_ext;
215 0 ▶ $blib_ext_dir =~ s!(.*)/.*!$1! or die;
Branch: 1 branch
BranchTrueFalseTotal
$blib_ext_dir =~ s[(.*)/.*][$1] or die 0 0 0
216 0 File::Path::mkpath $blib_ext_dir;
217 0 link $_, $blib_ext;
218 }
219 },
220 0 no_chdir => 1,
221 }, $inline_build_path);
222 }
223  
224 #------------------------------------------------------------------------------
225 # Worker methods.
226 #------------------------------------------------------------------------------
227 sub default_meta {
228 0 ▶ my ($class, $meta) = @_;
Subroutine default_meta: not called CC=8 SCAR=42.8
Pod undocumented
229 defined $meta->{module}
230 0 ▶ or die "Meta 'module' not defined";
Branch: 1 branch
BranchTrueFalseTotal
defined $meta->{"module"} or die "Meta 'module' not defined" 0 0 0
231 0 ▶ $meta->{module} = [ $meta->{module} ] unless ref $meta->{module};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $meta->{"module"} 0 0 0
232 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
233 0 ▶ $meta->{stub} = [ $meta->{stub} ] unless ref $meta->{stub};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $meta->{"stub"} 0 0 0
234 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
235 0 ▶ $meta->{ilsm} = [ $meta->{ilsm} ] unless ref $meta->{ilsm};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $meta->{"ilsm"} 0 0 0
236 0 ▶ $meta->{bundle} = 1 unless defined $meta->{bundle};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $meta->{"bundle"} 0 0 0
237 }
238  
239 sub included_modules {
240 0 ▶ my ($class, $meta) = @_;
Subroutine included_modules: not called CC=5 SCAR=34.0
Pod undocumented
241 0 ▶ return [] if not $meta->{bundle};
Branch: 1 branch
BranchTrueFalseTotal
unless $meta->{"bundle"} 0 0 0
242 0 my $ilsm = $meta->{ilsm};
243 0 my $include = [
244 'Inline',
245 'Inline::denter',
246 'Inline::Module',
247 @$ilsm,
248 ];
249 0 ▶ if (caller eq 'Module::Build::InlineModule') {
Branch: 1 branch
BranchTrueFalseTotal
if (caller eq "Module::Build::InlineModule") 0 0 0
250 0 push @$include, 'Module::Build::InlineModule';
251 }
252 0 ▶ if (grep /:C$/, @$ilsm) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep /:C$/, @$ilsm) 0 0 0
253 0 push @$include,
254 'Inline::C::Parser::RegExp';
255 }
256 0 ▶ if (grep /:CPP$/, @$ilsm) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep /:CPP$/, @$ilsm) 0 0 0
257 0 push @$include, (
258 'Inline::C',
259 'Inline::CPP::Config',
260 'Inline::CPP::Parser::RecDescent',
261 'Parse::RecDescent',
262 'ExtUtils::CppGuess',
263 'Capture::Tiny',
264 );
265 }
266 0 return $include;
267 }
268  
269 sub add_to_distdir {
270 0 ▶ my ($class, $distdir, $stub_modules, $included_modules) = @_;
Subroutine add_to_distdir: not called CC=5 SCAR=34.0
Pod undocumented
271 0 my $manifest = []; # files created under distdir
272 0 for my $module (@$stub_modules) {
273 0 my $code = $class->dyna_module($module);
274 0 $class->write_module("$distdir/lib", $module, $code);
275 0 $code = $class->proxy_module($module);
276 0 $class->write_module("$distdir/inc", $module, $code);
277 0 $module =~ s!::!/!g;
278 0 ▶ push @$manifest, "lib/$module.pm"
Branch: 1 branch
BranchTrueFalseTotal
unless -e "lib/$module.pm" 0 0 0
279 unless -e "lib/$module.pm";
280 0 push @$manifest, "inc/$module.pm";
281 }
282 0 for my $module (@$included_modules) {
283 0 ▶ my $code = $module eq 'Inline::CPP::Config'
Branch: 1 branch
BranchTrueFalseTotal
$module eq 'Inline::CPP::Config' ? : 0 0 0
284 ? $class->read_share_cpp_config
285 : $class->read_local_module($module);
286 0 $class->write_module("$distdir/inc", $module, $code);
287 0 $module =~ s!::!/!g;
288 0 push @$manifest, "inc/$module.pm";
289 }
290  
291 0 $class->add_to_manifest($distdir, @$manifest);
292  
293 0 return $manifest; # return a list of the files added
294 }
295  
296 sub make_stub_modules {
297 0 ▶ my ($class, @modules) = @_;
Subroutine make_stub_modules: not called CC=3 SCAR=24.8
Pod undocumented
298  
299 0 for my $module (@modules) {
300 0 my $code = $class->proxy_module($module);
301 0 my $path = $class->write_module('lib', $module, $code, 'onchange');
302 0 ▶ if ($path) {
Branch: 1 branch
BranchTrueFalseTotal
if ($path) 0 0 0
303 0 print "Created stub module '$path' (Inline::Module $VERSION)\n";
304 }
305 }
306 }
307  
308 sub read_local_module {
309 0 ▶ my ($class, $module) = @_;
Subroutine read_local_module: not called CC=2 SCAR=17.9
Pod undocumented
310 0 ▶ eval "require $module; 1" or die $@;
Branch: 1 branch
BranchTrueFalseTotal
eval "require $module; 1" or die $@ 0 0 0
311 0 my $file = $module;
312 0 $file =~ s!::!/!g;
313 0 $class->read_file($INC{"$file.pm"});
314 }
315  
316 sub read_share_cpp_config {
317 0 ▶ my ($class) = @_;
Subroutine read_share_cpp_config: not called CC=1 SCAR=6.9
Pod undocumented
318 0 require File::Share;
319 0 my $dir = File::Share::dist_dir('Inline-Module');
320 0 my $path = File::Spec->catfile($dir, 'CPPConfig.pm');
321 0 $class->read_file($path);
322 }
323  
324 sub proxy_module {
325 0 ▶ my ($class, $module) = @_;
Subroutine proxy_module: not called CC=1 SCAR=6.9
Pod undocumented
326  
327 0 return <<"...";
328 # DO NOT EDIT. GENERATED BY: Inline::Module
329 #
330 # This module is for author-side development only. When this module is shipped
331 # to CPAN, it will be automagically replaced with content that does not
332 # require any Inline framework modules (or any other non-core modules).
333 #
334 # To regenerate this stub module, run this command:
335 #
336 # perl -MInline::Module=makestub,$module
337  
338 use strict; use warnings;
339 package $module;
340 use Inline::Module stub => '$API_VERSION';
341 1;
342 ...
343 }
344  
345 sub dyna_module {
346 0 ▶ my ($class, $module) = @_;
Subroutine dyna_module: not called CC=1 SCAR=6.9
Pod undocumented
347 0 return <<"...";
348 # DO NOT EDIT. GENERATED BY: Inline::Module $Inline::Module::VERSION
349  
350 use strict; use warnings;
351 package $module;
352 use base 'DynaLoader';
353 bootstrap $module;
354 1;
355 ...
356  
357 # TODO: Add XS VERSION checking support:
358 # our \$VERSION = '0.0.5';
359 # bootstrap $module \$VERSION;
360 }
361  
362 sub read_file {
363 0 ▶ my ($class, $filepath) = @_;
Subroutine read_file: not called CC=2 SCAR=17.9
Pod undocumented
364 0 ▶ open IN, '<', $filepath
Branch: 1 branch
BranchTrueFalseTotal
open IN, "<", $filepath or die "Can't open '${filepath}' for input:\n$!" 0 0 0
365 or die "Can't open '$filepath' for input:\n$!";
366 0 my $code = do {local $/; <IN>};
367 0 close IN;
368 0 return $code;
369 }
370  
371 sub write_module {
372 0 ▶ my ($class, $dest, $module, $code, $onchange) = @_;
Subroutine write_module: not called CC=6 SCAR=37.4
Pod undocumented
373 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
374  
375 0 $code =~ s/\n+__END__\n.*//s;
376  
377 0 my $filepath = $module;
378 0 $filepath =~ s!::!/!g;
379 0 $filepath = "$dest/$filepath.pm";
380 0 my $dirpath = $filepath;
381 0 $dirpath =~ s!(.*)/.*!$1!;
382 0 File::Path::mkpath($dirpath);
383  
384 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
385 -e $filepath and
386 $class->read_file($filepath) eq $code;
387  
388 0 unlink $filepath;
389 0 ▶ open OUT, '>', $filepath
Branch: 1 branch
BranchTrueFalseTotal
open OUT, ">", $filepath or die "Can't open '${filepath}' for output:\n$!" 0 0 0
390 or die "Can't open '$filepath' for output:\n$!";
391 0 print OUT $code;
392 0 close OUT;
393  
394 0 return $filepath;
395 }
396  
397 sub add_to_manifest {
398 0 ▶ my ($class, $distdir, @files) = @_;
Subroutine add_to_manifest: not called CC=4 SCAR=30.0
Pod undocumented
399 0 my $manifest = "$distdir/MANIFEST";
400  
401 0 ▶ if (-w $manifest) {
Branch: 1 branch
BranchTrueFalseTotal
if (-w $manifest) 0 0 0
402 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
403 or die "Can't open '$manifest' for append:\n$!";
404 0 for my $file (@files) {
405 0 print $out "$file\n";
406 }
407 0 close $out;
408 }
409 }
410  
411 sub smoke_system_info_dump {
412 0 ▶ my ($class, @msg) = @_;
Subroutine smoke_system_info_dump: not called CC=1 SCAR=6.9
Pod undocumented
413 0 my $msg = sprintf(@msg);
414 0 chomp $msg;
415 0 require Data::Dumper;
416 0 local $Data::Dumper::Sortkeys = 1;
417 0 local $Data::Dumper::Terse = 1;
418 0 local $Data::Dumper::Indent = 1;
419  
420 0 my @path_files;
421 File::Find::find({
422 wanted => sub {
423 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
424 },
425 0 }, File::Spec->path());
426 0 my $dump = Data::Dumper::Dumper(
427 {
428 'ENV' => \%ENV,
429 'Config' => \%Config::Config,
430 'Path Files' => \@path_files,
431 },
432 );
433 0 Carp::confess <<"..."
434 Error: $msg
435  
436 System Data:
437 $dump
438  
439 Error: $msg
440 ...
441 }
442  
443 1 1;
↑ Summary auto/share/dist/Inline-Module/CPPConfig.pm »