File Coverage

blib/lib/ExtUtils/CBuilder/Platform/Unix.pm
Criterion Covered Total %
statement 18 20 90.0
branch 1 4 25.0
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 24 31 77.4


line stmt bran cond sub pod time code
1             package ExtUtils::CBuilder::Platform::Unix;
2              
3 4     4   28 use warnings;
  4         10  
  4         135  
4 4     4   21 use strict;
  4         11  
  4         79  
5 4     4   2205 use ExtUtils::CBuilder::Base;
  4         12  
  4         1412  
6              
7             our $VERSION = '0.280236'; # VERSION
8              
9             our @ISA = qw(ExtUtils::CBuilder::Base);
10              
11             sub link_executable {
12 1     1 0 2288 my $self = shift;
13              
14             # On some platforms (which ones??) $Config{cc} seems to be a better
15             # bet for linking executables than $Config{ld}. Cygwin is a notable
16             # exception.
17             local $self->{config}{ld} =
18 1         26 $self->{config}{cc} . " " . $self->{config}{ldflags};
19 1         45 return $self->SUPER::link_executable(@_);
20             }
21              
22             sub link {
23 8     8 0 962 my $self = shift;
24 8         365 my $cf = $self->{config};
25              
26             # Some platforms (notably Mac OS X 10.3, but some others too) expect
27             # the syntax "FOO=BAR /bin/command arg arg" to work in %Config
28             # (notably $Config{ld}). It usually works in system(SCALAR), but we
29             # use system(LIST). We fix it up here with 'env'.
30              
31 8         236 local $cf->{ld} = $cf->{ld};
32 8 50       111 if (ref $cf->{ld}) {
33 0 0       0 unshift @{$cf->{ld}}, 'env' if $cf->{ld}[0] =~ /^\s*\w+=/;
  0         0  
34             } else {
35 8         146 $cf->{ld} =~ s/^(\s*\w+=)/env $1/;
36             }
37              
38 8         221 return $self->SUPER::link(@_);
39             }
40              
41             1;