Skip to content

Commit f94190e

Browse files
committed
Stop using File::Spec inheritance internally
1 parent 45ca858 commit f94190e

File tree

8 files changed

+88
-86
lines changed

8 files changed

+88
-86
lines changed

lib/ExtUtils/Liblist.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ our $VERSION = '7.05_07';
66

77
use File::Spec;
88
require ExtUtils::Liblist::Kid;
9-
our @ISA = qw(ExtUtils::Liblist::Kid File::Spec);
9+
our @ISA = qw(ExtUtils::Liblist::Kid);
1010

1111
# Backwards compatibility with old interface.
1212
sub ext {

lib/ExtUtils/Liblist/Kid.pm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ sub _unix_os2_ext {
7878
}
7979
unless ( File::Spec->file_name_is_absolute( $thislib ) ) {
8080
warn "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n";
81-
$thislib = $self->catdir( $pwd, $thislib );
81+
$thislib = File::Spec->catdir( $pwd, $thislib );
8282
}
8383
push( @searchpath, $thislib );
8484
push( @extralibs, "$ptype$thislib" );
@@ -318,7 +318,7 @@ sub _win32_ext {
318318
elsif ( -d ) {
319319
unless ( File::Spec->file_name_is_absolute( $_ ) ) {
320320
warn "Warning: '$thislib' changed to '-L$pwd/$_'\n";
321-
$_ = $self->catdir( $pwd, $_ );
321+
$_ = File::Spec->catdir( $pwd, $_ );
322322
}
323323
push( @searchpath, $_ );
324324
next;
@@ -475,7 +475,7 @@ sub _vms_ext {
475475
if ( lc $type eq '/share' ) { $locspec .= $Config{'exe_ext'}; }
476476
elsif ( lc $type eq '/library' ) { $locspec .= $Config{'lib_ext'}; }
477477
else { $locspec .= $Config{'obj_ext'}; }
478-
$locspec = $self->catfile( $self->{PERL_SRC}, $locspec );
478+
$locspec = File::Spec->catfile( $self->{PERL_SRC}, $locspec );
479479
$lib = "$locspec$type" if -e $locspec;
480480
}
481481
}
@@ -539,7 +539,7 @@ sub _vms_ext {
539539
$dir = VMS::Filespec::vmspath( $dir );
540540
}
541541
else {
542-
$dir = $self->catdir( $cwd, $dir );
542+
$dir = File::Spec->catdir( $cwd, $dir );
543543
}
544544
}
545545
@dirs = grep { length( $_ ) } @dirs;

lib/ExtUtils/MM_Any.pm

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ use ExtUtils::MakeMaker qw($Verbose write_file_via_tmp neatvalue);
1313

1414
use ExtUtils::MakeMaker::Config;
1515

16-
1716
# So we don't have to keep calling the methods over and over again,
1817
# we have these globals to cache the values. Faster and shrtr.
19-
my $Curdir = __PACKAGE__->curdir;
20-
my $Rootdir = __PACKAGE__->rootdir;
21-
my $Updir = __PACKAGE__->updir;
18+
my $Curdir = File::Spec->curdir;
19+
my $Rootdir = File::Spec->rootdir;
20+
my $Updir = File::Spec->updir;
2221

2322
my $METASPEC_URL = 'https://metacpan.org/pod/CPAN::Meta::Spec';
2423
my $METASPEC_V = 2;
@@ -212,7 +211,7 @@ sub _clear_maketype_cache { %maketype2true = () }
212211
sub is_make_type {
213212
my($self, $type) = @_;
214213
return $maketype2true{$type} if defined $maketype2true{$type};
215-
(undef, undef, my $make_basename) = $self->splitpath($self->make);
214+
(undef, undef, my $make_basename) = File::Spec->splitpath($self->make);
216215
return $maketype2true{$type} = 1
217216
if $make_basename =~ /\b$type\b/i; # executable's filename
218217
return $maketype2true{$type} = 0
@@ -678,7 +677,7 @@ sub blibdirs_target {
678677
my ($v, $d, $f) = File::Spec->splitpath($ext);
679678
my @d = File::Spec->splitdir($d);
680679
shift @d if $d[0] eq 'lib';
681-
push @dirs, $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f);
680+
push @dirs, File::Spec->catdir('$(INST_ARCHLIB)', 'auto', @d, $f);
682681
}
683682
}
684683

@@ -755,8 +754,8 @@ clean :: clean_subdirs
755754
$(BASEEXT).exp $(BASEEXT).x
756755
]);
757756

758-
push(@files, $self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
759-
push(@files, $self->catfile('$(INST_ARCHAUTODIR)','extralibs.ld'));
757+
push(@files, File::Spec->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
758+
push(@files, File::Spec->catfile('$(INST_ARCHAUTODIR)','extralibs.ld'));
760759

761760
# core files
762761
if ($^O eq 'vos') {
@@ -1922,8 +1921,8 @@ to XS code. Those are handled in init_xs.
19221921
sub init_INST {
19231922
my($self) = shift;
19241923

1925-
$self->{INST_ARCHLIB} ||= $self->catdir($Curdir,"blib","arch");
1926-
$self->{INST_BIN} ||= $self->catdir($Curdir,'blib','bin');
1924+
$self->{INST_ARCHLIB} ||= File::Spec->catdir($Curdir,"blib","arch");
1925+
$self->{INST_BIN} ||= File::Spec->catdir($Curdir,'blib','bin');
19271926

19281927
# INST_LIB typically pre-set if building an extension after
19291928
# perl has been built and installed. Setting INST_LIB allows
@@ -1932,22 +1931,22 @@ sub init_INST {
19321931
if ($self->{PERL_CORE}) {
19331932
$self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB};
19341933
} else {
1935-
$self->{INST_LIB} = $self->catdir($Curdir,"blib","lib");
1934+
$self->{INST_LIB} = File::Spec->catdir($Curdir,"blib","lib");
19361935
}
19371936
}
19381937

19391938
my @parentdir = split(/::/, $self->{PARENT_NAME});
1940-
$self->{INST_LIBDIR} = $self->catdir('$(INST_LIB)', @parentdir);
1941-
$self->{INST_ARCHLIBDIR} = $self->catdir('$(INST_ARCHLIB)', @parentdir);
1942-
$self->{INST_AUTODIR} = $self->catdir('$(INST_LIB)', 'auto',
1939+
$self->{INST_LIBDIR} = File::Spec->catdir('$(INST_LIB)', @parentdir);
1940+
$self->{INST_ARCHLIBDIR} = File::Spec->catdir('$(INST_ARCHLIB)', @parentdir);
1941+
$self->{INST_AUTODIR} = File::Spec->catdir('$(INST_LIB)', 'auto',
19431942
'$(FULLEXT)');
1944-
$self->{INST_ARCHAUTODIR} = $self->catdir('$(INST_ARCHLIB)', 'auto',
1943+
$self->{INST_ARCHAUTODIR} = File::Spec->catdir('$(INST_ARCHLIB)', 'auto',
19451944
'$(FULLEXT)');
19461945

1947-
$self->{INST_SCRIPT} ||= $self->catdir($Curdir,'blib','script');
1946+
$self->{INST_SCRIPT} ||= File::Spec->catdir($Curdir,'blib','script');
19481947

1949-
$self->{INST_MAN1DIR} ||= $self->catdir($Curdir,'blib','man1');
1950-
$self->{INST_MAN3DIR} ||= $self->catdir($Curdir,'blib','man3');
1948+
$self->{INST_MAN1DIR} ||= File::Spec->catdir($Curdir,'blib','man1');
1949+
$self->{INST_MAN3DIR} ||= File::Spec->catdir($Curdir,'blib','man3');
19511950

19521951
return 1;
19531952
}
@@ -2157,7 +2156,7 @@ sub init_INSTALL_from_PREFIX {
21572156

21582157
if( $var =~ /arch/ ) {
21592158
$self->{$Installvar} ||=
2160-
$self->catdir($self->{LIB}, $Config{archname});
2159+
File::Spec->catdir($self->{LIB}, $Config{archname});
21612160
}
21622161
else {
21632162
$self->{$Installvar} ||= $self->{LIB};
@@ -2224,7 +2223,7 @@ sub init_INSTALL_from_INSTALL_BASE {
22242223
my $key = "INSTALL".$dir.$uc_thing;
22252224

22262225
$install{$key} ||=
2227-
$self->catdir('$(INSTALL_BASE)', @{$map{$thing}});
2226+
File::Spec->catdir('$(INSTALL_BASE)', @{$map{$thing}});
22282227
}
22292228
}
22302229

@@ -2745,11 +2744,11 @@ sub arch_check {
27452744

27462745
return 1 if $self->{PERL_SRC};
27472746

2748-
my($pvol, $pthinks) = $self->splitpath($pconfig);
2749-
my($cvol, $cthinks) = $self->splitpath($cconfig);
2747+
my($pvol, $pthinks) = File::Spec->splitpath($pconfig);
2748+
my($cvol, $cthinks) = File::Spec->splitpath($cconfig);
27502749

2751-
$pthinks = $self->canonpath($pthinks);
2752-
$cthinks = $self->canonpath($cthinks);
2750+
$pthinks = File::Spec->canonpath($pthinks);
2751+
$cthinks = File::Spec->canonpath($cthinks);
27532752

27542753
my $ret = 1;
27552754
if ($pthinks ne $cthinks) {
@@ -2758,7 +2757,7 @@ sub arch_check {
27582757

27592758
$ret = 0;
27602759

2761-
my $arch = (grep length, $self->splitdir($pthinks))[-1];
2760+
my $arch = (grep length, File::Spec->splitdir($pthinks))[-1];
27622761

27632762
print <<END unless $self->{UNINSTALLED_PERL};
27642763
Your perl and your Config.pm seem to have different ideas about the
@@ -2904,9 +2903,9 @@ installation.
29042903

29052904
sub libscan {
29062905
my($self,$path) = @_;
2907-
my($dirs,$file) = ($self->splitpath($path))[1,2];
2906+
my($dirs,$file) = (File::Spec->splitpath($path))[1,2];
29082907
return '' if grep /^(?:RCS|CVS|SCCS|\.svn|_darcs)$/,
2909-
$self->splitdir($dirs), $file;
2908+
File::Spec->splitdir($dirs), $file;
29102909

29112910
return $path;
29122911
}
@@ -3034,7 +3033,7 @@ Used by perldepend() in MM_Unix and MM_VMS via _perl_header_files_fragment()
30343033
sub _perl_header_files {
30353034
my $self = shift;
30363035

3037-
my $header_dir = $self->{PERL_SRC} || $ENV{PERL_SRC} || $self->catdir($Config{archlibexp}, 'CORE');
3036+
my $header_dir = $self->{PERL_SRC} || $ENV{PERL_SRC} || File::Spec->catdir($Config{archlibexp}, 'CORE');
30383037
opendir my $dh, $header_dir
30393038
or die "Failed to opendir '$header_dir' to find header files: $!";
30403039

lib/ExtUtils/MM_Unix.pm

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use Carp;
88
use ExtUtils::MakeMaker::Config;
99
use File::Basename qw(basename dirname);
1010
use DirHandle;
11+
use File::Spec;
1112

1213
our %Config_Override;
1314

@@ -97,9 +98,9 @@ something that used to be in here, look in MM_Any.
9798

9899
# So we don't have to keep calling the methods over and over again,
99100
# we have these globals to cache the values. Faster and shrtr.
100-
my $Curdir = __PACKAGE__->curdir;
101-
my $Rootdir = __PACKAGE__->rootdir;
102-
my $Updir = __PACKAGE__->updir;
101+
my $Curdir = File::Spec->curdir;
102+
my $Rootdir = File::Spec->rootdir;
103+
my $Updir = File::Spec->updir;
103104

104105

105106
=head2 Methods
@@ -1106,10 +1107,10 @@ WARNING
11061107
foreach my $dir (@$dirs){
11071108
next unless defined $dir; # $self->{PERL_SRC} may be undefined
11081109
my ($abs, $val);
1109-
if ($self->file_name_is_absolute($name)) { # /foo/bar
1110+
if (File::Spec->file_name_is_absolute($name)) { # /foo/bar
11101111
$abs = $name;
1111-
} elsif ($self->canonpath($name) eq
1112-
$self->canonpath(basename($name))) { # foo
1112+
} elsif (File::Spec->canonpath($name) eq
1113+
File::Spec->canonpath(basename($name))) { # foo
11131114
$abs = File::Spec->catfile($dir, $name);
11141115
} else { # foo/bar
11151116
$abs = File::Spec->catfile($Curdir, $name);
@@ -1241,7 +1242,7 @@ sub _fixin_replace_shebang {
12411242
}
12421243
else {
12431244
my (@absdirs)
1244-
= reverse grep { $self->file_name_is_absolute($_) } $self->path;
1245+
= reverse grep { File::Spec->file_name_is_absolute($_) } File::Spec->path;
12451246
$interpreter = '';
12461247

12471248
foreach my $dir (@absdirs) {
@@ -1962,21 +1963,21 @@ sub init_PERL {
19621963
my($self) = shift;
19631964

19641965
my @defpath = ();
1965-
foreach my $component ($self->{PERL_SRC}, $self->path(),
1966+
foreach my $component ($self->{PERL_SRC}, File::Spec->path(),
19661967
$Config{binexp})
19671968
{
19681969
push @defpath, $component if defined $component;
19691970
}
19701971

19711972
# Build up a set of file names (not command names).
1972-
my $thisperl = $self->canonpath($^X);
1973+
my $thisperl = File::Spec->canonpath($^X);
19731974
$thisperl .= $Config{exe_ext} unless
19741975
# VMS might have a file version # at the end
19751976
$Is{VMS} ? $thisperl =~ m/$Config{exe_ext}(;\d+)?$/i
19761977
: $thisperl =~ m/$Config{exe_ext}$/i;
19771978

19781979
# We need a relative path to perl when in the core.
1979-
$thisperl = $self->abs2rel($thisperl) if $self->{PERL_CORE};
1980+
$thisperl = File::Spec->abs2rel($thisperl) if $self->{PERL_CORE};
19801981

19811982
my @perls = ($thisperl);
19821983
push @perls, map { "$_$Config{exe_ext}" }
@@ -2029,11 +2030,11 @@ sub init_PERL {
20292030
# sometimes.
20302031
$self->{ABSPERL} = $self->{PERL};
20312032
$has_mcr = $self->{ABSPERL} =~ s/^MCR\s*//;
2032-
if( $self->file_name_is_absolute($self->{ABSPERL}) ) {
2033+
if( File::Spec->file_name_is_absolute($self->{ABSPERL}) ) {
20332034
$self->{ABSPERL} = '$(PERL)';
20342035
}
20352036
else {
2036-
$self->{ABSPERL} = $self->rel2abs($self->{ABSPERL});
2037+
$self->{ABSPERL} = File::Spec->rel2abs($self->{ABSPERL});
20372038

20382039
# Quote the perl command if it contains whitespace
20392040
$self->{ABSPERL} = $self->quote_literal($self->{ABSPERL})
@@ -3429,8 +3430,8 @@ sub static_lib {
34293430
my ($v, $d, $f) = File::Spec->splitpath($ext);
34303431
my @d = File::Spec->splitdir($d);
34313432
shift @d if $d[0] eq 'lib';
3432-
my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f);
3433-
my $instfile = $self->catfile($instdir, "$f\$(LIB_EXT)");
3433+
my $instdir = File::Spec->catdir('$(INST_ARCHLIB)', 'auto', @d, $f);
3434+
my $instfile = File::Spec->catfile($instdir, "$f\$(LIB_EXT)");
34343435
my $objfile = "$ext\$(OBJ_EXT)";
34353436
push @libs, [ $objfile, $instfile, $instdir ];
34363437
}

0 commit comments

Comments
 (0)