X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FFindBin.pm;h=9d35f6f9c9cc4328f32fb771857f63a1a59b5b78;hb=cc8461762c7674cd719f8f7e4a4e54252a249ef9;hp=b9aeb3640a705aebf3346d5865d16ff774bf6358;hpb=63abd72361fb73532e62d9d6ca4c48236f714f59;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/FindBin.pm b/lib/FindBin.pm index b9aeb36..9d35f6f 100644 --- a/lib/FindBin.pm +++ b/lib/FindBin.pm @@ -55,7 +55,10 @@ Workaround is to invoke perl as =head1 AUTHORS -Graham Barr EFE +FindBin is supported as part of the core perl distribution. Please send bug +reports to EFE using the perlbug program included with perl. + +Graham Barr EFE Nick Ing-Simmons EFE =head1 COPYRIGHT @@ -64,26 +67,22 @@ Copyright (c) 1995 Graham Barr & Nick Ing-Simmons. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -=head1 REVISION - -$Revision: 1.4 $ - =cut package FindBin; use Carp; require 5.000; require Exporter; -use File::Spec qw(file_name_is_absolute); use Cwd qw(getcwd abs_path); use Config; use File::Basename; +use File::Spec; @EXPORT_OK = qw($Bin $Script $RealBin $RealScript $Dir $RealDir); %EXPORT_TAGS = (ALL => [qw($Bin $Script $RealBin $RealScript $Dir $RealDir)]); @ISA = qw(Exporter); -$VERSION = $VERSION = sprintf("%d.%02d", q$Revision: 1.42 $ =~ /(\d+)\.(\d+)/); +$VERSION = "1.42"; BEGIN { @@ -113,13 +112,12 @@ BEGIN && -f $script) { my $dir; - my $pathvar = 'PATH'; - - foreach $dir (split(/$Config{'path_sep'}/,$ENV{$pathvar})) + foreach $dir (File::Spec->path) { - if(-r "$dir/$script" && (!$IsWin32 || -x _)) + my $scr = File::Spec->catfile($dir, $script); + if(-r $scr && (!$IsWin32 || -x _)) { - $script = "$dir/$script"; + $script = $scr; if (-f $0) { @@ -142,7 +140,8 @@ BEGIN # Ensure $script contains the complete path incase we C - $script = getcwd() . "/" . $script unless file_name_is_absolute($script); + $script = File::Spec->catfile(getcwd(), $script) + unless File::Spec->file_name_is_absolute($script); ($Script,$Bin) = fileparse($script); @@ -154,9 +153,9 @@ BEGIN ($RealScript,$RealBin) = fileparse($script); last unless defined $linktext; - $script = (file_name_is_absolute($linktext)) + $script = (File::Spec->file_name_is_absolute($linktext)) ? $linktext - : $RealBin . "/" . $linktext; + : File::Spec->catfile($RealBin, $linktext); } # Get absolute paths to directories