This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Module-Build to CPAN version 0.4204
[perl5.git] / cpan / Module-Build / lib / Module / Build / Platform / Unix.pm
CommitLineData
bb4e9162
YST
1package Module::Build::Platform::Unix;
2
3use strict;
7a827510 4use vars qw($VERSION);
71213e49 5$VERSION = '0.4204';
7a827510 6$VERSION = eval $VERSION;
bb4e9162
YST
7use Module::Build::Base;
8
9use vars qw(@ISA);
10@ISA = qw(Module::Build::Base);
11
f943a5bf
SP
12sub is_executable {
13 # We consider the owner bit to be authoritative on a file, because
14 # -x will always return true if the user is root and *any*
15 # executable bit is set. The -x test seems to try to answer the
16 # question "can I execute this file", but I think we want "is this
17 # file executable".
18
19 my ($self, $file) = @_;
20 return +(stat $file)[2] & 0100;
21}
22
bb4e9162
YST
23sub _startperl { "#! " . shift()->perl }
24
25sub _construct {
26 my $self = shift()->SUPER::_construct(@_);
27
28 # perl 5.8.1-RC[1-3] had some broken %Config entries, and
29 # unfortunately Red Hat 9 shipped it like that. Fix 'em up here.
30 my $c = $self->{config};
31 for (qw(siteman1 siteman3 vendorman1 vendorman3)) {
32 $c->{"install${_}dir"} ||= $c->{"install${_}"};
33 }
34
35 return $self;
36}
37
23837600
DG
38# Open group says username should be portable filename characters,
39# but some Unix OS working with ActiveDirectory wind up with user-names
40# with back-slashes in the name. The new code below is very liberal
41# in what it accepts.
7a827510
RGS
42sub _detildefy {
43 my ($self, $value) = @_;
23837600 44 $value =~ s[^~([^/]+)?(?=/|$)] # tilde with optional username
7a827510
RGS
45 [$1 ?
46 ((getpwnam $1)[7] || "~$1") :
15cb7b9d 47 ($ENV{HOME} || (getpwuid $>)[7])
7a827510
RGS
48 ]ex;
49 return $value;
50}
51
bb4e9162
YST
521;
53__END__
54
55
56=head1 NAME
57
58Module::Build::Platform::Unix - Builder class for Unix platforms
59
60=head1 DESCRIPTION
61
62The sole purpose of this module is to inherit from
63C<Module::Build::Base>. Please see the L<Module::Build> for the docs.
64
65=head1 AUTHOR
66
77e96e88 67Ken Williams <kwilliams@cpan.org>
bb4e9162
YST
68
69=head1 SEE ALSO
70
71perl(1), Module::Build(3), ExtUtils::MakeMaker(3)
72
73=cut