summaryrefslogtreecommitdiff
path: root/lib/File
diff options
context:
space:
mode:
Diffstat (limited to 'lib/File')
-rw-r--r--lib/File/Find/t/find.t35
-rw-r--r--lib/File/Find/t/taint.t9
2 files changed, 19 insertions, 25 deletions
diff --git a/lib/File/Find/t/find.t b/lib/File/Find/t/find.t
index 96a1000511..53ba648ad7 100644
--- a/lib/File/Find/t/find.t
+++ b/lib/File/Find/t/find.t
@@ -11,11 +11,21 @@ my ($warn_msg, @files, $file);
BEGIN {
require File::Spec;
- chdir 't' if -d 't';
- # May be doing dynamic loading while @INC is all relative
- unshift @INC => File::Spec->rel2abs('../lib');
-
- $SIG{'__WARN__'} = sub { $warn_msg = $_[0]; warn "# $_[0]"; }
+ if ($ENV{PERL_CORE}) {
+ # May be doing dynamic loading while @INC is all relative
+ @INC = map { $_ = File::Spec->rel2abs($_); /(.*)/; $1 } @INC;
+ }
+ $SIG{'__WARN__'} = sub { $warn_msg = $_[0]; warn "# $_[0]"; };
+
+ if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'VMS') {
+ # This is a hack - at present File::Find does not produce native names
+ # on Win32 or VMS, so force File::Spec to use Unix names.
+ # must be set *before* importing File::Find
+ require File::Spec::Unix;
+ @File::Spec::ISA = 'File::Spec::Unix';
+ }
+ require File::Find;
+ import File::Find;
}
my $test_count = 98;
@@ -45,21 +55,6 @@ my $orig_dir = cwd();
# };
# }
-
-BEGIN {
- use File::Spec;
- if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'VMS')
- {
- # This is a hack - at present File::Find does not produce native names on
- # Win32 or VMS, so force File::Spec to use Unix names.
- # must be set *before* importing File::Find
- require File::Spec::Unix;
- @File::Spec::ISA = 'File::Spec::Unix';
- }
- require File::Find;
- import File::Find;
-}
-
cleanup();
$::count_commonsense = 0;
diff --git a/lib/File/Find/t/taint.t b/lib/File/Find/t/taint.t
index 954c6780d9..d6fb256993 100644
--- a/lib/File/Find/t/taint.t
+++ b/lib/File/Find/t/taint.t
@@ -16,11 +16,10 @@ my ($cwd, $cwd_untainted);
BEGIN {
require File::Spec;
- chdir 't' if -d 't';
- # May be doing dynamic loading while @INC is all relative
- my $lib = File::Spec->rel2abs('../lib');
- $lib = $1 if $lib =~ m/(.*)/;
- unshift @INC => $lib;
+ if ($ENV{PERL_CORE}) {
+ # May be doing dynamic loading while @INC is all relative
+ @INC = map { $_ = File::Spec->rel2abs($_); /(.*)/; $1 } @INC;
+ }
}
use Config;