mirror of
https://github.com/Perl/perl5.git
synced 2026-01-30 11:25:45 +00:00
In a perl core build, the @INC paths will be relative. If you change directories before loading all of the files needed, they won't be able to be found. Config.pm loads some of its values at runtime, so if they are accessed after a chdir, it may fail. One of the PathTools tests was relying on the fact that Config_heavy.pl would be loaded by Test::More, before it did a chdir. Newer Test::More won't do that, so the test would fail. Accessing the required Config values early will prevent this failure. This same issue is unlikely to impact anything outside core, as it requires the perl core paths in @INC to be relative paths, which is normally not the case.
129 lines
2.3 KiB
Perl
129 lines
2.3 KiB
Perl
package File::Spec::Functions;
|
|
|
|
use File::Spec;
|
|
use strict;
|
|
|
|
our $VERSION = '3.94';
|
|
$VERSION =~ tr/_//d;
|
|
|
|
require Exporter;
|
|
|
|
our @ISA = qw(Exporter);
|
|
|
|
our @EXPORT = qw(
|
|
canonpath
|
|
catdir
|
|
catfile
|
|
curdir
|
|
rootdir
|
|
updir
|
|
no_upwards
|
|
file_name_is_absolute
|
|
path
|
|
);
|
|
|
|
our @EXPORT_OK = qw(
|
|
devnull
|
|
tmpdir
|
|
splitpath
|
|
splitdir
|
|
catpath
|
|
abs2rel
|
|
rel2abs
|
|
case_tolerant
|
|
);
|
|
|
|
our %EXPORT_TAGS = ( ALL => [ @EXPORT_OK, @EXPORT ] );
|
|
|
|
require File::Spec::Unix;
|
|
my %udeps = (
|
|
canonpath => [],
|
|
catdir => [qw(canonpath)],
|
|
catfile => [qw(canonpath catdir)],
|
|
case_tolerant => [],
|
|
curdir => [],
|
|
devnull => [],
|
|
rootdir => [],
|
|
updir => [],
|
|
);
|
|
|
|
foreach my $meth (@EXPORT, @EXPORT_OK) {
|
|
my $sub = File::Spec->can($meth);
|
|
no strict 'refs';
|
|
if (exists($udeps{$meth}) && $sub == File::Spec::Unix->can($meth) &&
|
|
!(grep {
|
|
File::Spec->can($_) != File::Spec::Unix->can($_)
|
|
} @{$udeps{$meth}}) &&
|
|
defined(&{"File::Spec::Unix::_fn_$meth"})) {
|
|
*{$meth} = \&{"File::Spec::Unix::_fn_$meth"};
|
|
} else {
|
|
*{$meth} = sub {&$sub('File::Spec', @_)};
|
|
}
|
|
}
|
|
|
|
|
|
1;
|
|
__END__
|
|
|
|
=head1 NAME
|
|
|
|
File::Spec::Functions - portably perform operations on file names
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
use File::Spec::Functions;
|
|
my $x = catfile('a', 'b');
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
This module exports convenience functions for all of the class methods
|
|
provided by File::Spec.
|
|
|
|
For a reference of available functions, please consult L<File::Spec::Unix>,
|
|
which contains the entire set, and which is inherited by the modules for
|
|
other platforms. For further information, please see L<File::Spec::Mac>,
|
|
L<File::Spec::OS2>, L<File::Spec::Win32>, or L<File::Spec::VMS>.
|
|
|
|
=head2 Exports
|
|
|
|
The following functions are exported by default.
|
|
|
|
canonpath
|
|
catdir
|
|
catfile
|
|
curdir
|
|
rootdir
|
|
updir
|
|
no_upwards
|
|
file_name_is_absolute
|
|
path
|
|
|
|
|
|
The following functions are exported only by request.
|
|
|
|
devnull
|
|
tmpdir
|
|
splitpath
|
|
splitdir
|
|
catpath
|
|
abs2rel
|
|
rel2abs
|
|
case_tolerant
|
|
|
|
All the functions may be imported using the C<:ALL> tag.
|
|
|
|
=head1 COPYRIGHT
|
|
|
|
Copyright (c) 2004 by the Perl 5 Porters. All rights reserved.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the same terms as Perl itself.
|
|
|
|
=head1 SEE ALSO
|
|
|
|
File::Spec, File::Spec::Unix, File::Spec::Mac, File::Spec::OS2,
|
|
File::Spec::Win32, File::Spec::VMS, ExtUtils::MakeMaker
|
|
|
|
=cut
|
|
|