diff options
author | Dave Rolsky <autarch@urth.org> | 2001-12-24 07:27:23 -0600 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-12-24 22:58:18 +0000 |
commit | ecf68df6e17568faac489c8f52d98e01e32472af (patch) | |
tree | 9cc6067e7520f3d3040c2bc3759cf5a94f024a8b /lib/ExtUtils/MM_Win32.pm | |
parent | e036fef9c83c3a56ef6c3a3bedfa658fcb8a2517 (diff) | |
download | perl-ecf68df6e17568faac489c8f52d98e01e32472af.tar.gz |
: ExtUtils::MM_* and File::Spec
Message-ID: <Pine.LNX.4.43.0112241305020.21723-100000@urth.org>
p4raw-id: //depot/perl@13880
Diffstat (limited to 'lib/ExtUtils/MM_Win32.pm')
-rw-r--r-- | lib/ExtUtils/MM_Win32.pm | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 7b5d142fde..478424958d 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -23,6 +23,7 @@ the semantics. use Config; #use Cwd; use File::Basename; +use File::Spec; require Exporter; require ExtUtils::MakeMaker; @@ -137,8 +138,8 @@ sub maybe_command { } sub file_name_is_absolute { - my($self,$file) = @_; - $file =~ m{^([a-z]:)?[\\/]}i ; + shift; + return File::Spec->file_name_is_absolute(@_); } sub find_perl { @@ -155,12 +156,12 @@ in these dirs: next unless defined $dir; # $self->{PERL_SRC} may be undefined foreach $name (@$names){ my ($abs, $val); - if ($self->file_name_is_absolute($name)) { # /foo/bar + if (File::Spec->file_name_is_absolute($name)) { # /foo/bar $abs = $name; - } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # foo - $abs = $self->catfile($dir, $name); + } elsif (File::Spec->canonpath($name) eq File::Spec->canonpath(basename($name))) { # foo + $abs = File::Spec->catfile($dir, $name); } else { # foo/bar - $abs = $self->canonpath($self->catfile($self->curdir, $name)); + $abs = File::Spec->canonpath(File::Spec->catfile(File::Spec->curdir, $name)); } print "Checking $abs\n" if ($trace >= 2); next unless $self->maybe_command($abs); @@ -179,14 +180,8 @@ in these dirs: } sub catdir { - my $self = shift; - my @args = @_; - for (@args) { - # append a slash to each argument unless it has one there - $_ .= "\\" if $_ eq '' or substr($_,-1) ne "\\"; - } - my $result = $self->canonpath(join('', @args)); - $result; + shift; + return File::Spec->catdir(@_); } =item catfile @@ -197,13 +192,8 @@ complete path ending with a filename =cut sub catfile { - my $self = shift @_; - my $file = pop @_; - return $file unless @_; - my $dir = $self->catdir(@_); - $dir =~ s/(\\\.)$//; - $dir .= "\\" unless substr($dir,length($dir)-1,1) eq "\\"; - return $dir.$file; + shift; + return File::Spec->catfile(@_); } sub init_others @@ -347,11 +337,11 @@ CONFIGDEP = \$(PERL_ARCHLIB)\\Config.pm \$(PERL_INC)\\config.h my @parentdir = split(/::/, $self->{PARENT_NAME}); push @m, q{ # Where to put things: -INST_LIBDIR = }. $self->catdir('$(INST_LIB)',@parentdir) .q{ -INST_ARCHLIBDIR = }. $self->catdir('$(INST_ARCHLIB)',@parentdir) .q{ +INST_LIBDIR = }. File::Spec->catdir('$(INST_LIB)',@parentdir) .q{ +INST_ARCHLIBDIR = }. File::Spec->catdir('$(INST_ARCHLIB)',@parentdir) .q{ -INST_AUTODIR = }. $self->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{ -INST_ARCHAUTODIR = }. $self->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{ +INST_AUTODIR = }. File::Spec->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{ +INST_ARCHAUTODIR = }. File::Spec->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{ }; if ($self->has_link_code()) { @@ -394,11 +384,7 @@ PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{ sub path { - my($self) = @_; - my $path = $ENV{'PATH'} || $ENV{'Path'} || $ENV{'path'}; - my @path = split(';',$path); - foreach(@path) { $_ = '.' if $_ eq '' } - @path; + return File::Spec->path(); } =item static_lib (o) @@ -608,7 +594,7 @@ destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION> sub pm_to_blib { my $self = shift; - my($autodir) = $self->catdir('$(INST_LIB)','auto'); + my($autodir) = File::Spec->catdir('$(INST_LIB)','auto'); return q{ pm_to_blib: $(TO_INST_PM) }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \ @@ -842,9 +828,9 @@ sub htmlifypods { my($dist); my($pod2html_exe); if (defined $self->{PERL_SRC}) { - $pod2html_exe = $self->catfile($self->{PERL_SRC},'pod','pod2html'); + $pod2html_exe = File::Spec->catfile($self->{PERL_SRC},'pod','pod2html'); } else { - $pod2html_exe = $self->catfile($Config{scriptdirexp},'pod2html'); + $pod2html_exe = File::Spec->catfile($Config{scriptdirexp},'pod2html'); } unless ($pod2html_exe = $self->perl_script($pod2html_exe)) { # No pod2html but some HTMLxxxPODS to be installed |