lib/ExtUtils/Mkbootstrap.pm

filter: Statementstmt 97.8% 45 / 46 Branchbran 90.0% 18 / 20 Conditioncond 83.3% 5 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 91.1% 72 / 79 CC 13 SCAR 24.4
CC
13
Cov
94%
Mkbootstrap
13.1
BEGIN
1.0
BEGIN
1.0
CRAP 11.4
« blib/lib/ExtUtils/MM_AIX.pm ↑ Summary blib/lib/ExtUtils/Command.pm »
1 package ExtUtils::Mkbootstrap;
2  
3 # There's just too much Dynaloader incest here to turn on strict vars.
4 2 ▶use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '7.13_01';
7 2 $VERSION = eval $VERSION;
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 sub Mkbootstrap {
19 8 ▶ my($baseext, @bsloadlibs)=@_;
Subroutine Mkbootstrap: called CC=13 SCAR=25.7
Pod undocumented
20 8 @bsloadlibs = grep($_, @bsloadlibs); # strip empty libs
21  
22 8 ▶ print " bsloadlibs=@bsloadlibs\n" if $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $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 1 local($osname, $dlsrc) = (); # avoid warnings
37 1 ($osname, $dlsrc) = @Config::Config{qw(osname dlsrc)};
38 1 $bscode = "";
39 1 unshift @INC, ".";
40 1 require $_;
41 1 shift @INC;
42 }
43  
44 8 ▶ if ($Config{'dlsrc'} =~ /^dl_dld/){
Branch: 1 branch
BranchTrueFalseTotal
if ($Config{"dlsrc"} =~ /^dl_dld/) 0 8 8
45 package DynaLoader;
46 0 push(@dl_resolve_using, dl_findfile('-lc'));
47 }
48  
49 8 my(@all) = (@bsloadlibs, @DynaLoader::dl_resolve_using);
50 8 my($method) = '';
51 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
Condition83%5/6
@all or defined $DynaLoader::bscode and length $DynaLoader::bscode
l!l&&r!l&&!r
431
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 table50%2/4
A or B and C
A= @allB= defined $DynaLoader::bscodeC= length $DynaLoader::bscode
ABCresult
1XX1
0111
00X0
0100
52 4 ▶ open my $bs, ">", "$baseext.bs"
Branch: 1 branch
BranchTrueFalseTotal
open my $bs, ">", "$baseext.bs" or die "Unable to open $baseext.bs: $!" 1 3 4
53 or die "Unable to open $baseext.bs: $!";
54 3 print "Writing $baseext.bs\n";
55 3 ▶ print " containing: @all" if $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $Verbose 2 1 3
56 3 print $bs "# $baseext DynaLoader bootstrap file for $^O architecture.\n";
57 3 print $bs "# Do not edit this file, changes will be lost.\n";
58 3 print $bs "# This file was automatically generated by the\n";
59 3 print $bs "# Mkbootstrap routine in ExtUtils::Mkbootstrap (v$VERSION).\n";
60 3 ▶ if (@all) {
Branch: 1 branch
BranchTrueFalseTotal
if (@all) 3 0 3
61 3 print $bs "\@DynaLoader::dl_resolve_using = ";
62 # If @all contains names in the form -lxxx or -Lxxx then it's asking for
63 # runtime library location so we automatically add a call to dl_findfile()
64 3 ▶ if (" @all" =~ m/ -[lLR]/){
Branch: 1 branch
BranchTrueFalseTotal
if ((" @all") =~ / -[lLR]/) { } 1 2 3
65 1 print $bs " dl_findfile(qw(\n @all\n ));\n";
66 } else {
67 2 print $bs " qw(@all);\n";
68 }
69 }
70 # write extra code if *_BS says so
71 3 ▶ print $bs $DynaLoader::bscode if $DynaLoader::bscode;
Branch: 1 branch
BranchTrueFalseTotal
if $DynaLoader::bscode 1 2 3
72 3 print $bs "\n1;\n";
73 3 close $bs;
74 }
75 }
76  
77 2 1;
78  
79 __END__
« blib/lib/ExtUtils/MM_AIX.pm ↑ Summary blib/lib/ExtUtils/Command.pm »