# Change 'perl' to './perl' so the shell doesn't go looking through PATH.
sub safe_rel {
- return File::Spec->catfile(File::Spec->curdir, $_[0]);
+ my($perl) = shift;
+ $perl = File::Spec->catfile(File::Spec->curdir, $perl) unless
+ File::Spec->file_name_is_absolute($perl);
+
+ return $perl;
}
# Here we make sure File::Spec can properly deal with executables.
# VMS has some trouble with these.
-my $perl = File::Spec->rel2abs($^X);
-is( `$^X -le "print 'ok'"`, "ok\n", '`` works' );
+my $perl = safe_rel($^X);
+is( `$perl -le "print 'ok'"`, "ok\n", '`` works' );
+
+$perl = File::Spec->rel2abs($^X);
is( `$perl -le "print 'ok'"`, "ok\n", 'rel2abs($^X)' );
$perl = File::Spec->canonpath($perl);
$perl = safe_rel(File::Spec->abs2rel($perl));
is( `$perl -le "print 'ok'"`, "ok\n", 'abs2rel()' );
-$perl = File::Spec->canonpath($^X);
+$perl = safe_rel(File::Spec->canonpath($^X));
is( `$perl -le "print 'ok'"`, "ok\n", 'canonpath on rel executable' );