File Coverage

blib/lib/Module/Build/Platform/Unix.pm
Criterion Covered Total %
statement 17 21 80.9
branch 0 2 0.0
condition 1 9 11.1
subroutine 6 7 85.7
pod 0 1 0.0
total 24 40 60.0


line stmt bran cond sub pod time code
1             package Module::Build::Platform::Unix;
2              
3 293     293   2124 use strict;
  293         784  
  293         10111  
4 293     293   1702 use warnings;
  293         645  
  293         17897  
5             our $VERSION = '0.4234';
6             $VERSION = eval $VERSION;
7 293     293   2727 use Module::Build::Base;
  293         613  
  293         109164  
8              
9             our @ISA = qw(Module::Build::Base);
10              
11             sub is_executable {
12             # We consider the owner bit to be authoritative on a file, because
13             # -x will always return true if the user is root and *any*
14             # executable bit is set. The -x test seems to try to answer the
15             # question "can I execute this file", but I think we want "is this
16             # file executable".
17              
18 144     144 0 595 my ($self, $file) = @_;
19 144         2665 return +(stat $file)[2] & 0100;
20             }
21              
22 6     6   85 sub _startperl { "#! " . shift()->perl }
23              
24             sub _construct {
25 560     560   22483 my $self = shift()->SUPER::_construct(@_);
26              
27             # perl 5.8.1-RC[1-3] had some broken %Config entries, and
28             # unfortunately Red Hat 9 shipped it like that. Fix 'em up here.
29 546         3837 my $c = $self->{config};
30 546         2485 for (qw(siteman1 siteman3 vendorman1 vendorman3)) {
31 2184   33     22492 $c->{"install${_}dir"} ||= $c->{"install${_}"};
32             }
33              
34 546         6037 return $self;
35             }
36              
37             # Open group says username should be portable filename characters,
38             # but some Unix OS working with ActiveDirectory wind up with user-names
39             # with back-slashes in the name. The new code below is very liberal
40             # in what it accepts.
41             sub _detildefy {
42 0     0     my ($self, $value) = @_;
43 0           $value =~ s[^~([^/]+)?(?=/|$)] # tilde with optional username
44             [$1 ?
45 0 0 0       (eval{(getpwnam $1)[7]} || "~$1") :
      0        
46             ($ENV{HOME} || eval{(getpwuid $>)[7]} || glob("~"))
47 0           ]ex;
48             return $value;
49             }
50              
51             1;
52             __END__
53              
54              
55             =head1 NAME
56              
57             Module::Build::Platform::Unix - Builder class for Unix platforms
58              
59             =head1 DESCRIPTION
60              
61             The sole purpose of this module is to inherit from
62             C<Module::Build::Base>. Please see the L<Module::Build> for the docs.
63              
64             =head1 AUTHOR
65              
66             Ken Williams <kwilliams@cpan.org>
67              
68             =head1 SEE ALSO
69              
70             perl(1), Module::Build(3), ExtUtils::MakeMaker(3)
71              
72             =cut