summaryrefslogtreecommitdiff
path: root/lib/FindBin.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-05-03 08:53:25 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-05-03 08:53:25 +0000
commit7d161605f8e10199e4c300f0a0e3d3c71656ee35 (patch)
tree71016c62b77cc639158c7a3e3afe03ba753eef08 /lib/FindBin.pm
parent62e1ddac2ea58cd2a35011515be4801254772ba8 (diff)
downloadperl-7d161605f8e10199e4c300f0a0e3d3c71656ee35.tar.gz
Fix for [perl #34252] Access rights in FindBin::Bin
At least on my platform, Cwd::getcwd doesn't find the current directory if it has no access to it. Try harder with Cwd::cwd. p4raw-id: //depot/perl@24375
Diffstat (limited to 'lib/FindBin.pm')
-rw-r--r--lib/FindBin.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/FindBin.pm b/lib/FindBin.pm
index 4610beb2cd..122f083f3d 100644
--- a/lib/FindBin.pm
+++ b/lib/FindBin.pm
@@ -93,7 +93,7 @@ package FindBin;
use Carp;
require 5.000;
require Exporter;
-use Cwd qw(getcwd abs_path);
+use Cwd qw(getcwd cwd abs_path);
use Config;
use File::Basename;
use File::Spec;
@@ -102,7 +102,7 @@ use File::Spec;
%EXPORT_TAGS = (ALL => [qw($Bin $Script $RealBin $RealScript $Dir $RealDir)]);
@ISA = qw(Exporter);
-$VERSION = "1.44";
+$VERSION = "1.45";
sub init
{
@@ -158,8 +158,10 @@ sub init
croak("Cannot find current script '$0'") unless(-f $script);
- # Ensure $script contains the complete path incase we C<chdir>
+ # Ensure $script contains the complete path in case we C<chdir>
+ my $cwd = getcwd();
+ defined $cwd or $cwd = cwd(); # try harder
$script = File::Spec->catfile(getcwd(), $script)
unless File::Spec->file_name_is_absolute($script);