example/inc/Module/Install/XSUtil.pm

filter: Statementstmt 49.8% 124 / 249 Branchbran 27.2% 24 / 88 Conditioncond 10.5% 4 / 38 MC/DCmcdc 0.0% 0 / 21 Subroutinesub 71.8% 23 / 32 Podpod 0.0% 0 / 11 totaltotal 39.8% 175 / 439 CC 65 SCAR 37.0
CC
65
Cov
41%
install_headers
156.0
_extract_functions_from_header_file
112.9
cc_src_paths
56.0
CRAP 40.4
↑ Summary example/inc/Module/Install/Metadata.pm »
1 #line 1
2 package Module::Install::XSUtil;
3 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
4 use 5.005_03;
5 1  
6 $VERSION = '0.11';
7 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 use Module::Install::Base;
9 @ISA = qw(Module::Install::Base);
10 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
11 use strict;
12 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
13 use Config;
14 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 use File::Find;
17 1 ▶ 
Subroutine BEGIN: called CC=2 SCAR=7.1
Branch: 1 branch
BranchTrueFalseTotal
$ENV{'MI_VERBOSE'} ? : 0 1 1
18 use constant _VERBOSE => $ENV{MI_VERBOSE} ? 1 : 0;
19 1  
20 my %BuildRequires = (
21 'Devel::PPPort' => 3.19,
22 'ExtUtils::ParseXS' => 2.20,
23 'XSLoader' => 0.08,
24 );
25 1  
26 my %ToInstall;
27 0 ▶ 
Subroutine _verbose: not called CC=1 SCAR=6.9
28 0 sub _verbose{
29 print STDERR q{# }, @_, "\n";
30 }
31 1 ▶ 
Subroutine _xs_debugging: called CC=2 SCAR=9.2
32 0 ▶sub _xs_debugging{
Condition50%1/2
$ENV{'XS_DEBUG'} || scalar grep({$_ eq '-g';} @ARGV)
l!l
01
MC/DC0%0/1
$ENV{'XS_DEBUG'} || scalar grep({$_ eq '-g';} @ARGV)
$ENV{'XS_DEBUG'}
Truth table50%1/2
A
A= $ENV{'XS_DEBUG'}
Aresult
11
00
33 return $ENV{XS_DEBUG} || scalar( grep{ $_ eq '-g' } @ARGV );
34 }
35 8 ▶ 
Subroutine _xs_initialize: called CC=4 SCAR=15.5
36 8 sub _xs_initialize{
37 my($self) = @_;
38 8 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"xsu_initialized"}) 1 7 8
39 1 unless($self->{xsu_initialized}){
40 $self->{xsu_initialized} = 1;
41 1  
42 1 $self->requires_external_cc();
43 1 $self->build_requires(%BuildRequires);
44 $self->makemaker_args(OBJECT => '$(O_FILES)');
45 1 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_xs_debugging) 0 1 1
46 if($self->_xs_debugging()){
47 0 ▶ # override $Config{optimize}
Branch: 1 branch
BranchTrueFalseTotal
if (_is_msvc()) { } 0 0 0
48 0 if(_is_msvc()){
49 $self->makemaker_args(OPTIMIZE => '-Zi');
50 }
51 0 else{
52 $self->makemaker_args(OPTIMIZE => '-g');
53 }
54 }
55 8 }
56 return;
57 }
58  
59 1 ▶# GNU C Compiler
Subroutine _is_gcc: called CC=1 SCAR=0.0
60 1 sub _is_gcc{
61 return $Config{gccversion};
62 }
63  
64 2 ▶# Microsoft Visual C++ Compiler (cl.exe)
Subroutine _is_msvc: called CC=1 SCAR=0.0
65 2 sub _is_msvc{
66 return $Config{cc} =~ /\A cl \b /xmsi;
67 }
68 1 ▶ 
Subroutine use_ppport: called CC=4 SCAR=14.0
Pod undocumented
69 1 sub use_ppport{
70 my($self, $dppp_version) = @_;
71 1  
72 $self->_xs_initialize();
73 1  
74 my $filename = 'ppport.h';
75 1 ▶ 
Condition50%1/2
$dppp_version ||= 0
l!l
10
MC/DC0%0/1
$dppp_version ||= 0
$dppp_version
Truth table50%1/2
A
A= $dppp_version
Aresult
11
00
76 1 $dppp_version ||= 0;
77 $self->configure_requires('Devel::PPPort' => $dppp_version);
78 1  
79 print "Writing $filename\n";
80 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
eval "\n\t\tuse Devel::PPPort;\n\t\tDevel::PPPort::WriteFile(q{$filename});\n\t\t1;\n\t" or warn "Cannot create ${filename}: $@" 1 0 1
81 eval qq{
82 use Devel::PPPort;
83 Devel::PPPort::WriteFile(q{$filename});
84 1;
85 } or warn("Cannot create $filename: $@");
86  
87 1 ▶
Branch: 1 branch
BranchTrueFalseTotal
if (-e $filename) 1 0 1
88 1 if(-e $filename){
89 1 $self->clean_files($filename);
90 1 $self->cc_append_to_ccflags('-DUSE_PPPORT');
91 $self->cc_append_to_inc('.');
92 1 }
93 return;
94 }
95 1 ▶ 
Subroutine cc_warnings: called CC=3 SCAR=12.7
Pod undocumented
96 1 sub cc_warnings{
97 my($self) = @_;
98 1  
99 $self->_xs_initialize();
100 1 ▶ 
Branch: 2 branches
BranchTrueFalseTotal
if (_is_gcc()) { } 1 0 1
elsif (_is_msvc()) { } 0 0 0
101 1 if(_is_gcc()){
102 $self->cc_append_to_ccflags(qw(-Wall -Wextra));
103 }
104 0 elsif(_is_msvc()){
105 $self->cc_append_to_ccflags('-W3');
106 }
107 else{
108 # TODO: support other compilers
109 }
110 1  
111 return;
112 }
113  
114 2 ▶ 
Subroutine cc_append_to_inc: called CC=4 SCAR=14.0
Pod undocumented
115 2 sub cc_append_to_inc{
116 my($self, @dirs) = @_;
117 2  
118 $self->_xs_initialize();
119 2  
120 2 ▶ for my $dir(@dirs){
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $dir) 0 2 2
121 0 unless(-d $dir){
122 0 warn("'$dir' not found: $!\n");
123 exit;
124 }
125 2  
126 _verbose "inc: -I$dir" if _VERBOSE;
127 }
128 2  
129 2 my $mm = $self->makemaker_args;
130 my $paths = join q{ }, map{ s{\\}{\\\\}g; qq{"-I$_"} } @dirs;
131 2 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if ($mm->{'INC'}) { } 1 1 2
132 1 if($mm->{INC}){
133 $mm->{INC} .= q{ } . $paths;
134 }
135 1 else{
136 $mm->{INC} = $paths;
137 2 }
138 return;
139 }
140 1 ▶ 
Subroutine cc_append_to_libs: called CC=4 SCAR=19.6
Pod undocumented
141 1 sub cc_append_to_libs{
142 my($self, @libs) = @_;
143 1  
144 $self->_xs_initialize();
145 1  
146 my $mm = $self->makemaker_args;
147  
148 0 ▶ my $libs = join q{ }, map{
Branch: 1 branch
BranchTrueFalseTotal
ref $_ eq 'ARRAY' ? : 0 0 0
149 my($name, $dir) = ref($_) eq 'ARRAY' ? @{$_} : ($_, undef);
150 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if defined $dir 0 0 0
151 0 $dir = qq{-L$dir } if defined $dir;
152 0 _verbose "libs: $dir-l$name" if _VERBOSE;
153 $dir . qq{-l$name};
154 } @libs;
155 1 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if ($mm->{'LIBS'}) { } 0 1 1
156 0 if($mm->{LIBS}){
157 $mm->{LIBS} .= q{ } . $libs;
158 }
159 1 else{
160 $mm->{LIBS} = $libs;
161 }
162 1  
163 return;
164 }
165 2 ▶ 
Subroutine cc_append_to_ccflags: called CC=2 SCAR=7.0
Pod undocumented
166 2 sub cc_append_to_ccflags{
167 my($self, @ccflags) = @_;
168 2  
169 $self->_xs_initialize();
170 2  
171 my $mm = $self->makemaker_args;
172 2 ▶ 
Condition66%2/3
$mm->{"CCFLAGS"} ||= $Module::Install::XSUtil::Config{"ccflags"}
l!l&&r!l&&!r
110
MC/DC0%0/2
$mm->{"CCFLAGS"} ||= $Module::Install::XSUtil::Config{"ccflags"}
$mm->{"CCFLAGS"} $Module::Install::XSUtil::Config{"ccflags"}
Truth table66%2/3
A ||= B
A= $mm->{"CCFLAGS"}B= $Module::Install::XSUtil::Config{"ccflags"}
ABresult
1X1
011
000
173 2 $mm->{CCFLAGS} ||= $Config{ccflags};
174 2 $mm->{CCFLAGS} .= q{ } . join q{ }, @ccflags;
175 return;
176 }
177 0 ▶ 
Subroutine cc_define: not called CC=2 SCAR=17.9
Pod undocumented
178 0 sub cc_define{
179 my($self, @defines) = @_;
180 0  
181 $self->_xs_initialize();
182 0  
183 0 ▶ my $mm = $self->makemaker_args;
Branch: 1 branch
BranchTrueFalseTotal
if (exists $mm->{'DEFINE'}) { } 0 0 0
184 0 if(exists $mm->{DEFINE}){
185 $mm->{DEFINE} .= q{ } . join q{ }, @defines;
186 }
187 0 else{
188 $mm->{DEFINE} = join q{ }, @defines;
189 0 }
190 return;
191 }
192 1 ▶ 
Subroutine requires_xs: called CC=6 SCAR=18.8
Pod undocumented
193 1 sub requires_xs{
194 my $self = shift;
195 1 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 1 1
196 return $self->requires() unless @_;
197 1  
198 $self->_xs_initialize();
199 1  
200 1 my %added = $self->requires(@_);
201 my(@inc, @libs);
202 1  
203 1 my $rx_lib = qr{ \. (?: lib | a) \z}xmsi;
204 my $rx_dll = qr{ \. dll \z}xmsi; # for Cygwin
205 1 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $module = each %added)) 1 1 2
206 1 while(my $module = each %added){
207 1 my $mod_basedir = File::Spec->join(split /::/, $module);
208 my $rx_header = qr{\A ( .+ \Q$mod_basedir\E ) .+ \. h(?:pp)? \z}xmsi;
209 1  
210 2 SCAN_INC: foreach my $inc_dir(@INC){
211 my @dirs = grep{ -e } File::Spec->join($inc_dir, 'auto', $mod_basedir), File::Spec->join($inc_dir, $mod_basedir);
212 2 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
unless @dirs 1 1 2
213 next SCAN_INC unless @dirs;
214 1  
215 4 ▶ my $n_inc = scalar @inc;
Subroutine __ANON__: called CC=5 SCAR=23.4
216 4 ▶ find(sub{
Branch: 3 branches
BranchTrueFalseTotal
if (my($incdir) = $File::Find::name =~ /$rx_header/imsx) { } 1 3 4
elsif ($File::Find::name =~ /$rx_lib/imsx) { } 0 3 3
elsif ($File::Find::name =~ /$rx_dll/imsx) { } 0 3 3
217 1 if(my($incdir) = $File::Find::name =~ $rx_header){
218 push @inc, $incdir;
219 }
220 0 elsif($File::Find::name =~ $rx_lib){
221 0 my($libname) = $_ =~ /\A (?:lib)? (\w+) /xmsi;
222 push @libs, [$libname, $File::Find::dir];
223 }
224 elsif($File::Find::name =~ $rx_dll){
225 0 # XXX: hack for Cygwin
226 0 ▶ my $mm = $self->makemaker_args;
Condition0%0/2
$mm->{"macro"}{"PERL_ARCHIVE_AFTER"} ||= ""
l!l
00
MC/DC0%0/1
$mm->{"macro"}{"PERL_ARCHIVE_AFTER"} ||= ""
$mm->{"macro"}{"PERL_ARCHIVE_AFTER"}
Truth table0%0/2
A
A= $mm->{"macro"}{"PERL_ARCHIVE_AFTER"}
Aresult
11
00
227 0 $mm->{macro}->{PERL_ARCHIVE_AFTER} ||= '';
228 $mm->{macro}->{PERL_ARCHIVE_AFTER} .= ' ' . $File::Find::name;
229 1 }
230 }, @dirs);
231 1 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if ($n_inc != scalar @inc) 1 0 1
232 1 if($n_inc != scalar @inc){
233 last SCAN_INC;
234 }
235 }
236 }
237 1  
238 1 my %uniq = ();
239 $self->cc_append_to_inc (grep{ !$uniq{ $_ }++ } @inc);
240 1  
241 0 %uniq = ();
242 $self->cc_append_to_libs(grep{ !$uniq{ $_->[0] }++ } @libs);
243 1  
244 return %added;
245 }
246 0 ▶ 
Subroutine cc_src_paths: not called CC=7 SCAR=40.3
Pod undocumented
247 0 sub cc_src_paths{
248 my($self, @dirs) = @_;
249 0  
250 $self->_xs_initialize();
251 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
unless @dirs 0 0 0
252 @dirs = qw(.) unless @dirs;
253 0  
254 my $mm = $self->makemaker_args;
255 0 ▶ 
Condition0%0/2
$mm->{"XS"} ||= {}
l!l
00
MC/DC0%0/1
$mm->{"XS"} ||= {}
$mm->{"XS"}
Truth table0%0/2
A
A= $mm->{"XS"}
Aresult
11
00
256 0 ▶ my $XS_ref = $mm->{XS} ||= {};
Condition0%0/2
$mm->{"C"} ||= []
l!l
00
MC/DC0%0/1
$mm->{"C"} ||= []
$mm->{"C"}
Truth table0%0/2
A
A= $mm->{"C"}
Aresult
11
00
257 my $C_ref = $mm->{C} ||= [];
258 0  
259 my $_obj = $Config{_o};
260 0  
261 0 ▶ my @src_files;
Subroutine __ANON__: not called CC=2 SCAR=17.9
262 0 ▶ find(sub{
Branch: 1 branch
BranchTrueFalseTotal
if (/ \. (?: xs | c (?: c | pp | xx )? ) \z/imsx) 0 0 0
263 0 if(/ \. (?: xs | c (?: c | pp | xx )? ) \z/xmsi){ # *.{xs, c, cc, cpp, cxx}
264 push @src_files, $File::Find::name;
265 0 }
266 }, @dirs);
267 0  
268 0 foreach my $src_file(@src_files){
269 0 ▶ my $c = $src_file;
Branch: 1 branch
BranchTrueFalseTotal
if ($c =~ s/ \.xs \z/.c/msx) { } 0 0 0
270 0 if($c =~ s/ \.xs \z/.c/xms){
271 $XS_ref->{$src_file} = $c;
272 0  
273 _verbose "xs: $src_file" if _VERBOSE;
274 }
275 0 else{
276 _verbose "c: $c" if _VERBOSE;
277 }
278 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$_ eq $c;} @{$C_ref;} 0 0 0
279 push @{$C_ref}, $c unless grep{ $_ eq $c } @{$C_ref};
280 }
281 0  
282 $self->cc_append_to_inc('.');
283 0  
284 return;
285 }
286 0 ▶ 
Subroutine cc_include_paths: not called CC=4 SCAR=30.0
Pod undocumented
287 0 sub cc_include_paths{
288 my($self, @dirs) = @_;
289 0  
290 $self->_xs_initialize();
291 0 ▶ 
Condition0%0/2
$self->{"xsu_include_paths"} ||= []
l!l
00
MC/DC0%0/1
$self->{"xsu_include_paths"} ||= []
$self->{"xsu_include_paths"}
Truth table0%0/2
A
A= $self->{"xsu_include_paths"}
Aresult
11
00
292 push @{ $self->{xsu_include_paths} ||= []}, @dirs;
293 0 ▶ 
Condition0%0/2
$self->{"xsu_header_map"} ||= {}
l!l
00
MC/DC0%0/1
$self->{"xsu_header_map"} ||= {}
$self->{"xsu_header_map"}
Truth table0%0/2
A
A= $self->{"xsu_header_map"}
Aresult
11
00
294 my $h_map = $self->{xsu_header_map} ||= {};
295 0  
296 0 foreach my $dir(@dirs){
297 0 ▶ my $prefix = quotemeta( File::Spec->catfile($dir, '') );
Subroutine __ANON__: not called CC=2 SCAR=17.9
298 0 ▶ find(sub{
Branch: 1 branch
BranchTrueFalseTotal
unless / \.h(?:pp)? \z/msx 0 0 0
299 return unless / \.h(?:pp)? \z/xms;
300 0  
301 0 (my $h_file = $File::Find::name) =~ s/ \A $prefix //xms;
302 0 $h_map->{$h_file} = $File::Find::name;
303 }, $dir);
304 }
305 0  
306 $self->cc_append_to_inc(@dirs);
307 0  
308 return;
309 }
310 0 ▶ 
Subroutine install_headers: not called CC=12 SCAR=50.5
Pod undocumented
311 0 sub install_headers{
312 0 my $self = shift;
313 0 ▶ my $h_files;
Branch: 2 branches
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
elsif (@_ == 1 and ref $_[0] eq 'HASH') { } 0 0 0
314 0 ▶ if(@_ == 0){
Branch: 1 branch
BranchTrueFalseTotal
$h_files = $self->{"xsu_header_map"} or die "install_headers: cc_include_paths not specified.\n" 0 0 0
315 $h_files = $self->{xsu_header_map} or die "install_headers: cc_include_paths not specified.\n";
316 ▶ }
Condition0%0/3
@_ == 1 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
317 0 elsif(@_ == 1 && ref($_[0]) eq 'HASH'){
318 $h_files = $_[0];
319 }
320 0 else{
321 $h_files = +{ map{ $_ => undef } @_ };
322 }
323 0  
324 $self->_xs_initialize();
325 0  
326 0 ▶ my @not_found;
Condition0%0/2
$self->{'xsu_header_map'} || {}
l!l
00
MC/DC0%0/1
$self->{'xsu_header_map'} || {}
$self->{'xsu_header_map'}
Truth table0%0/2
A
A= $self->{'xsu_header_map'}
Aresult
11
00
327 my $h_map = $self->{xsu_header_map} || {};
328 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$h_files;}) 0 0 0
329 0 ▶ while(my($ident, $path) = each %{$h_files}){
Condition0%0/6
$path ||= $h_map->{$ident} || "File::Spec"->join(".", $ident)
l!l&&r!l&&!r
000
$h_map->{$ident} || 'File::Spec'->join('.', $ident)
l!l&&r!l&&!r
000
MC/DC0%0/3
$path ||= $h_map->{$ident} || "File::Spec"->join(".", $ident)
$path $h_map->{$ident} 'File::Spec'->join('.', $ident)
Truth table0%0/4
A ||= B || C
A= $pathB= $h_map->{$ident}C= 'File::Spec'->join('.', $ident)
ABCresult
1XX1
01X1
0011
0000
330 0 $path ||= $h_map->{$ident} || File::Spec->join('.', $ident);
331 $path = File::Spec->canonpath($path);
332 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
unless ($path and -e $path) 0 0 0
Condition0%0/3
$path and -e $path
!ll&&!rl&&r
000
MC/DC0%0/2
$path and -e $path
$path -e $path
Truth table0%0/3
A and B
A= $pathB= -e $path
ABresult
0X0
100
111
333 0 unless($path && -e $path){
334 0 push @not_found, $ident;
335 next;
336 }
337 0  
338 $ToInstall{$path} = File::Spec->join('$(INST_ARCHAUTODIR)', $ident);
339 0  
340 0 _verbose "install: $path as $ident" if _VERBOSE;
341 $self->_extract_functions_from_header_file($path);
342 }
343 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if (@not_found) 0 0 0
344 0 if(@not_found){
345 die "Header file(s) not found: @not_found\n";
346 }
347 0  
348 return;
349 }
350  
351 my $home_directory;
352 0 ▶ 
Subroutine _extract_functions_from_header_file: not called CC=11 SCAR=47.3
353 0 sub _extract_functions_from_header_file{
354 my($self, $h_file) = @_;
355 0  
356 my @functions;
357 0 ▶ 
Subroutine BEGIN: called CC=1 SCAR=1.2
Branch: 1 branch
BranchTrueFalseTotal
unless defined $home_directory 0 0 0
358 ($home_directory) = <~> unless defined $home_directory;
359  
360 0 # get header file contents through cpp(1)
361 0 my $contents = do {
362 my $mm = $self->makemaker_args;
363 0  
364 0 my $cppflags = q{"-I}. File::Spec->join($Config{archlib}, 'CORE') . q{"};
365 $cppflags =~ s/~/$home_directory/g;
366 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if $mm->{"INC"} 0 0 0
367 $cppflags .= ' ' . $mm->{INC} if $mm->{INC};
368 0 ▶ 
Condition0%0/3
$mm->{'CCFLAGS'} || $Module::Install::XSUtil::Config{'ccflags'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$mm->{'CCFLAGS'} || $Module::Install::XSUtil::Config{'ccflags'}
$mm->{'CCFLAGS'} $Module::Install::XSUtil::Config{'ccflags'}
Truth table0%0/3
A || B
A= $mm->{'CCFLAGS'}B= $Module::Install::XSUtil::Config{'ccflags'}
ABresult
1X1
011
000
369 0 ▶ $cppflags .= ' ' . ($mm->{CCFLAGS} || $Config{ccflags});
Branch: 1 branch
BranchTrueFalseTotal
if $mm->{"DEFINE"} 0 0 0
370 $cppflags .= ' ' . $mm->{DEFINE} if $mm->{DEFINE};
371 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
_is_msvc() ? : 0 0 0
372 0 my $add_include = _is_msvc() ? '-FI' : '-include';
373 $cppflags .= ' ' . join ' ', map{ qq{$add_include "$_"} } qw(EXTERN.h perl.h XSUB.h);
374 0  
375 my $cppcmd = qq{$Config{cpprun} $cppflags $h_file};
376 0  
377 0 _verbose("extract functions from: $cppcmd") if _VERBOSE;
378 `$cppcmd`;
379 };
380 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $contents) 0 0 0
381 0 unless(defined $contents){
382 die "Cannot call C pre-processor ($Config{cpprun}): $! ($?)";
383 }
384  
385 0 # remove other include file contents
386 0 my $chfile = q/\# (?:line)? \s+ \d+/;
387 $contents =~ s{
388 ^$chfile \s+ (?! "\Q$h_file\E" ) .* $
389 .*
390 ^(?= $chfile)
391 }{}xmsig;
392 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if ($contents =~ / ([^\\;\s]+ # type \s+ ([a-zA-Z_][a-zA-Z0-9_]*) # function name \s* \( [^;#]* \) # argument list [\w\s\(\)]* # attributes or something ;) # end of declaration /gmsx) 0 0 0
393 while($contents =~ m{
394 ([^\\;\s]+ # type
395 \s+
396 ([a-zA-Z_][a-zA-Z0-9_]*) # function name
397 \s*
398 \( [^;#]* \) # argument list
399 [\w\s\(\)]* # attributes or something
400 ;) # end of declaration
401 0 }xmsg){
402 0 my $decl = $1;
403 my $name = $2;
404 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if $decl =~ /\b typedef \b/msx 0 0 0
405 0 ▶ next if $decl =~ /\b typedef \b/xms;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /^_/msx 0 0 0
406 next if $name =~ /^_/xms; # skip something private
407 0  
408 push @functions, $name;
409 0  
410 if(_VERBOSE){
411 $decl =~ tr/\n\r\t / /s;
412 $decl =~ s/ (\Q$name\E) /<$name>/xms;
413 _verbose("decl: $decl");
414 }
415 }
416 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if (@functions) 0 0 0
417 0 if(@functions){
418 $self->cc_append_to_funclist(@functions);
419 }
420 0  
421 return;
422 }
423  
424 0 ▶ 
Subroutine cc_append_to_funclist: not called CC=3 SCAR=24.8
Pod undocumented
425 0 sub cc_append_to_funclist{
426 my($self, @functions) = @_;
427 0  
428 $self->_xs_initialize();
429 0  
430 my $mm = $self->makemaker_args;
431 0 ▶ 
Condition0%0/2
$mm->{"FUNCLIST"} ||= []
l!l
00
MC/DC0%0/1
$mm->{"FUNCLIST"} ||= []
$mm->{"FUNCLIST"}
Truth table0%0/2
A
A= $mm->{"FUNCLIST"}
Aresult
11
00
432 0 ▶ push @{$mm->{FUNCLIST} ||= []}, @functions;
Condition0%0/2
$mm->{"DL_FUNCS"} ||= {"\$(NAME)", []}
l!l
00
MC/DC0%0/1
$mm->{"DL_FUNCS"} ||= {"\$(NAME)", []}
$mm->{"DL_FUNCS"}
Truth table0%0/2
A
A= $mm->{"DL_FUNCS"}
Aresult
11
00
433 $mm->{DL_FUNCS} ||= { '$(NAME)' => [] };
434 0  
435 return;
436 }
437  
438  
439 package
440 MY;
441 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
442 use Config;
443  
444 1 ▶# XXX: We must append to PM inside ExtUtils::MakeMaker->new().
Subroutine init_PM: called CC=2 SCAR=7.4
445 1 sub init_PM{
446 my $self = shift;
447 1  
448 $self->SUPER::init_PM(@_);
449 1 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %ToInstall) 0 1 1
450 0 while(my($k, $v) = each %ToInstall){
451 $self->{PM}{$k} = $v;
452 1 }
453 return;
454 }
455  
456 2 ▶# append object file names to CCCMD
Subroutine const_cccmd: called CC=3 SCAR=11.6
457 2 sub const_cccmd {
458 my $self = shift;
459 2  
460 2 ▶ my $cccmd = $self->SUPER::const_cccmd(@_);
Branch: 1 branch
BranchTrueFalseTotal
unless $cccmd 0 2 2
461 return q{} unless $cccmd;
462 2 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if (Module::Install::XSUtil::_is_msvc()) { } 0 2 2
463 0 if (Module::Install::XSUtil::_is_msvc()){
464 $cccmd .= ' -Fo$@';
465 }
466 2 else {
467 $cccmd .= ' -o $@';
468 }
469 2  
470 return $cccmd
471 }
472 1  
473 1;
474 __END__
↑ Summary example/inc/Module/Install/Metadata.pm »