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   30 use warnings;
  4         10  
  4         135  
4 4     4   25 use strict;
  4         8  
  4         85  
5 4     4   1794 use ExtUtils::CBuilder::Base;
  4         14  
  4         1416  
6              
7             our $VERSION = '0.280235'; # VERSION
8             our @ISA = qw(ExtUtils::CBuilder::Base);
9              
10             sub link_executable {
11 1     1 0 2212 my $self = shift;
12              
13             # On some platforms (which ones??) $Config{cc} seems to be a better
14             # bet for linking executables than $Config{ld}. Cygwin is a notable
15             # exception.
16             local $self->{config}{ld} =
17 1         26 $self->{config}{cc} . " " . $self->{config}{ldflags};
18 1         50 return $self->SUPER::link_executable(@_);
19             }
20              
21             sub link {
22 8     8 0 760 my $self = shift;
23 8         433 my $cf = $self->{config};
24              
25             # Some platforms (notably Mac OS X 10.3, but some others too) expect
26             # the syntax "FOO=BAR /bin/command arg arg" to work in %Config
27             # (notably $Config{ld}). It usually works in system(SCALAR), but we
28             # use system(LIST). We fix it up here with 'env'.
29              
30 8         237 local $cf->{ld} = $cf->{ld};
31 8 50       108 if (ref $cf->{ld}) {
32 0 0       0 unshift @{$cf->{ld}}, 'env' if $cf->{ld}[0] =~ /^\s*\w+=/;
  0         0  
33             } else {
34 8         116 $cf->{ld} =~ s/^(\s*\w+=)/env $1/;
35             }
36              
37 8         220 return $self->SUPER::link(@_);
38             }
39              
40             1;