From: Craig A. Berry Date: Sat, 27 Jan 2007 17:45:27 +0000 (+0000) Subject: For FindBin to work as advertised on VMS, $FindBin::Bin X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1cc0bb181613a49eb613dcbf3ac15b1ee178f165;p=p5sagit%2Fp5-mst-13.2.git For FindBin to work as advertised on VMS, $FindBin::Bin must be in unix syntax. p4raw-id: //depot/perl@30037 --- diff --git a/lib/FindBin.pm b/lib/FindBin.pm index 0d75414..ed5d040 100644 --- a/lib/FindBin.pm +++ b/lib/FindBin.pm @@ -106,6 +106,13 @@ use File::Spec; $VERSION = "1.48"; + +# needed for VMS-specific filename translation +if( $^O eq 'VMS' ) { + require VMS::Filespec; + VMS::Filespec->import; +} + sub cwd2 { my $cwd = getcwd(); # getcwd might fail if it hasn't access to the current directory. @@ -124,6 +131,7 @@ sub init # perl invoked with -e or script is on C $Script = $RealScript = $0; $Bin = $RealBin = cwd2(); + $Bin = VMS::Filespec::unixify($Bin) if $^O eq 'VMS'; } else { @@ -131,7 +139,9 @@ sub init if ($^O eq 'VMS') { - ($Bin,$Script) = VMS::Filespec::rmsexpand($0) =~ /(.*\])(.*)/s; + ($Bin,$Script) = VMS::Filespec::rmsexpand($0) =~ /(.*[\]>]+)(.*)/s; + # C isn't going to work, so unixify first + ($Bin = VMS::Filespec::unixify($Bin)) =~ s/\/\z//; ($RealBin,$RealScript) = ($Bin,$Script); } else