X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FFindBin.pm;h=bbd72a2aa262c825fd5fc15cacd8286caa1365b0;hb=08a4aec0f8cf03ed75a2a45bbd19128b4b70440a;hp=ecfa3005b22ed8b86074de5f8a6b19e760adb503;hpb=a73990fdb7aa812be91abe65dea1c0c2af4eb8ed;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/FindBin.pm b/lib/FindBin.pm index ecfa300..bbd72a2 100644 --- a/lib/FindBin.pm +++ b/lib/FindBin.pm @@ -11,12 +11,12 @@ FindBin - Locate directory of original perl script =head1 SYNOPSIS use FindBin; - BEGIN { unshift(@INC,"$FindBin::Bin/../lib") } + use lib "$FindBin::Bin/../lib"; or use FindBin qw($Bin); - BEGIN { unshift(@INC,"$Bin/../lib") } + use lib "$Bin/../lib"; =head1 DESCRIPTION @@ -24,11 +24,11 @@ Locates the full path to the script bin directory to allow the use of paths relative to the bin directory. This allows a user to setup a directory tree for some software with -directories /bin and /lib and then the above example will allow +directories ErootE/bin and ErootE/lib and then the above example will allow the use of modules in the lib directory without knowing where the software tree is installed. -If perl is invoked using the -e option or the perl script is read from +If perl is invoked using the B<-e> option or the perl script is read from C then FindBin sets both C<$Bin> and C<$RealBin> to the current directory. @@ -46,7 +46,7 @@ if perl is invoked as perl filename and I does not have executable rights and a program called I -exists in the users C<$ENV{PATH}> which satisfies both -x and -T then FindBin +exists in the users C<$ENV{PATH}> which satisfies both B<-x> and B<-T> then FindBin assumes that it was invoked via the C<$ENV{PATH}>. Workaround is to invoke perl as @@ -55,8 +55,8 @@ Workaround is to invoke perl as =head1 AUTHORS -Graham Barr -Nick Ing-Simmons +Graham Barr EFE +Nick Ing-Simmons EFE =head1 COPYRIGHT @@ -96,7 +96,7 @@ $VERSION = $VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/); # $realpath; #} -sub abs_path +sub my_abs_path { my $start = shift || '.'; my($dotdots, $cwd, @pst, @cst, $dir, @tst); @@ -154,6 +154,8 @@ BEGIN { *Dir = \$Bin; *RealDir = \$RealBin; + if (defined &Cwd::sys_abspath) { *abs_path = \&Cwd::sys_abspath} + else { *abs_path = \&my_abs_path} if($0 eq '-e' || $0 eq '-') {