lib/ExtUtils/Mkbootstrap.pm

filter: Statementstmt 100% 50 / 50 Branchbran 94.4% 17 / 18 Conditioncond 66.6% 4 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 92.7% 77 / 83 CC 12 SCAR 22.3
CC
12
Cov
96%
Mkbootstrap
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 9.3
« lib/ExtUtils/MM_NW5.pm ↑ Summary lib/ExtUtils/Command.pm »
1 package ExtUtils::Mkbootstrap;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '7.78';
7 2 $VERSION =~ tr/_//d;
8  
9 2 require Exporter;
10 2 our @ISA = ('Exporter');
11 2 our @EXPORT = ('&Mkbootstrap');
12  
13 2 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 our $Verbose = 0;
16  
17  
18 8 ▶sub Mkbootstrap {
Subroutine Mkbootstrap: called CC=12 SCAR=24.9
Pod undocumented
19 8 my($baseext, @bsloadlibs)=@_;
20 8 @bsloadlibs = grep($_, @bsloadlibs); # strip empty libs
21  
22 8 ▶ print " bsloadlibs=@bsloadlibs\n" if $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Mkbootstrap::Verbose 5 3 8
23  
24 # We need DynaLoader here because we and/or the *_BS file may
25 # call dl_findfile(). We don't say `use' here because when
26 # first building perl extensions the DynaLoader will not have
27 # been built when MakeMaker gets first used.
28 8 require DynaLoader;
29  
30 8 ▶ rename "$baseext.bs", "$baseext.bso"
Branch: 1 branch
BranchTrueFalseTotal
if -s "$baseext.bs" 1 7 8
31 if -s "$baseext.bs";
32  
33 8 ▶ if (-f "${baseext}_BS"){
Branch: 1 branch
BranchTrueFalseTotal
if (-f "${baseext}_BS") 1 7 8
34 1 $_ = "${baseext}_BS";
35 package DynaLoader; # execute code as if in DynaLoader
36 2 ▶ no strict 'vars';
Subroutine BEGIN: called CC=1 SCAR=0.0
37 1 local($osname, $dlsrc) = (); # avoid warnings
38 1 ($osname, $dlsrc) = @Config::Config{qw(osname dlsrc)};
39 1 $bscode = "";
40 1 unshift @INC, ".";
41 1 require $_;
42 1 shift @INC;
43 }
44  
45 8 my(@all) = (@bsloadlibs, @DynaLoader::dl_resolve_using);
46 8 my($method) = '';
47 8 ▶ if (@all || (defined $DynaLoader::bscode && length $DynaLoader::bscode)){
Branch: 1 branch
BranchTrueFalseTotal
if (@all or defined $DynaLoader::bscode and length $DynaLoader::bscode) 4 4 8
Condition66%4/6
@all or defined $DynaLoader::bscode and length $DynaLoader::bscode
l!l&&r!l&&!r
404
defined $DynaLoader::bscode and length $DynaLoader::bscode
!ll&&!rl&&r
310
MC/DC33%1/3
@all or defined $DynaLoader::bscode and length $DynaLoader::bscode
@all defined $DynaLoader::bscode length $DynaLoader::bscode
Truth table75%3/4
A or B and C
A= @allB= defined $DynaLoader::bscodeC= length $DynaLoader::bscode
ABCresult
1XX1
0111
00X0
0100
48 4 ▶ open my $bs, ">", "$baseext.bs"
Branch: 1 branch
BranchTrueFalseTotal
open my $bs, ">", "$baseext.bs" or die "Unable to open $baseext.bs: $!" 3 1 4
49 or die "Unable to open $baseext.bs: $!";
50 3 print "Writing $baseext.bs\n";
51 3 ▶ print " containing: @all" if $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Mkbootstrap::Verbose 2 1 3
52 3 print $bs "# $baseext DynaLoader bootstrap file for $^O architecture.\n";
53 3 print $bs "# Do not edit this file, changes will be lost.\n";
54 3 print $bs "# This file was automatically generated by the\n";
55 3 print $bs "# Mkbootstrap routine in ExtUtils::Mkbootstrap (v$VERSION).\n";
56 3 ▶ if (@all) {
Branch: 1 branch
BranchTrueFalseTotal
if (@all) 3 0 3
57 3 print $bs "\@DynaLoader::dl_resolve_using = ";
58 # If @all contains names in the form -lxxx or -Lxxx then it's asking for
59 # runtime library location so we automatically add a call to dl_findfile()
60 3 ▶ if (" @all" =~ m/ -[lLR]/){
Branch: 1 branch
BranchTrueFalseTotal
if ((" @all") =~ / -[lLR]/) { } 1 2 3
61 1 print $bs " dl_findfile(qw(\n @all\n ));\n";
62 } else {
63 2 print $bs " qw(@all);\n";
64 }
65 }
66 # write extra code if *_BS says so
67 3 ▶ print $bs $DynaLoader::bscode if $DynaLoader::bscode;
Branch: 1 branch
BranchTrueFalseTotal
if $DynaLoader::bscode 1 2 3
68 3 print $bs "\n1;\n";
69 3 close $bs;
70 }
71 }
72  
73 2 1;
74  
75 __END__
« lib/ExtUtils/MM_NW5.pm ↑ Summary lib/ExtUtils/Command.pm »