blib/lib/ExtUtils/Mkbootstrap.pm untested

filter: Statementstmt 0.0% 0 / 52 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 8 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 85 CC 10 SCAR 43.0
CC
10
Cov
0%
Mkbootstrap
110.0
BEGIN
2.0
BEGIN
2.0
CRAP 74.0
1 package ExtUtils::Mkbootstrap;
2  
3 # There's just too much Dynaloader incest here to turn on strict vars.
4 use strict 'refs';
5  
6 our $VERSION = '7.13_01';
7 $VERSION = eval $VERSION;
8  
9 require Exporter;
10 our @ISA = ('Exporter');
11 our @EXPORT = ('&Mkbootstrap');
12  
13 use Config;
14  
15 our $Verbose = 0;
16  
17  
18 sub Mkbootstrap {
19 my($baseext, @bsloadlibs)=@_;
20 @bsloadlibs = grep($_, @bsloadlibs); # strip empty libs
21  
22 print " bsloadlibs=@bsloadlibs\n" if $Verbose;
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 require DynaLoader;
29  
30 rename "$baseext.bs", "$baseext.bso"
31 if -s "$baseext.bs";
32  
33 if (-f "${baseext}_BS"){
34 $_ = "${baseext}_BS";
35 package DynaLoader; # execute code as if in DynaLoader
36 local($osname, $dlsrc) = (); # avoid warnings
37 ($osname, $dlsrc) = @Config::Config{qw(osname dlsrc)};
38 $bscode = "";
39 unshift @INC, ".";
40 require $_;
41 shift @INC;
42 }
43  
44 if ($Config{'dlsrc'} =~ /^dl_dld/){
45 package DynaLoader;
46 push(@dl_resolve_using, dl_findfile('-lc'));
47 }
48  
49 my(@all) = (@bsloadlibs, @DynaLoader::dl_resolve_using);
50 my($method) = '';
51 if (@all || (defined $DynaLoader::bscode && length $DynaLoader::bscode)){
52 open my $bs, ">", "$baseext.bs"
53 or die "Unable to open $baseext.bs: $!";
54 print "Writing $baseext.bs\n";
55 print " containing: @all" if $Verbose;
56 print $bs "# $baseext DynaLoader bootstrap file for $^O architecture.\n";
57 print $bs "# Do not edit this file, changes will be lost.\n";
58 print $bs "# This file was automatically generated by the\n";
59 print $bs "# Mkbootstrap routine in ExtUtils::Mkbootstrap (v$VERSION).\n";
60 if (@all) {
61 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 if (" @all" =~ m/ -[lLR]/){
65 print $bs " dl_findfile(qw(\n @all\n ));\n";
66 } else {
67 print $bs " qw(@all);\n";
68 }
69 }
70 # write extra code if *_BS says so
71 print $bs $DynaLoader::bscode if $DynaLoader::bscode;
72 print $bs "\n1;\n";
73 close $bs;
74 }
75 }
76  
77 1;
78  
79 __END__