package FindBin;
use Carp;
require 5.000;
require Exporter;
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 = "1.42";
BEGIN{*Dir=\$Bin;
*RealDir=\$RealBin;
if($0 eq '-e'||$0 eq '-'){$Script=$RealScript=$0;
$Bin=$RealBin=getcwd();}else{my$script=$0;
if($^O eq 'VMS'){($Bin,$Script)=VMS::Filespec::rmsexpand($0)=~/(.*\])(.*)/s;
($RealBin,$RealScript)=($Bin,$Script);}else{my$IsWin32=$^O eq 'MSWin32';
unless(($script=~m#/#||($IsWin32&&$script=~m#\\#))&&-f$script){my$dir;
foreach$dir(File::Spec->path){my$scr=File::Spec->catfile($dir,$script);
if(-r$scr&&(!$IsWin32||-x _)){$script=$scr;
if(-f$0){$script=$0 unless(-T$script);}last;}}}croak("Cannot find current script '$0'")unless(-f$script);
$script=File::Spec->catfile(getcwd(),$script)unless File::Spec->file_name_is_absolute($script);
($Script,$Bin)=fileparse($script);
while(1){my$linktext=readlink($script);
($RealScript,$RealBin)=fileparse($script);
last unless defined$linktext;
$script=(File::Spec->file_name_is_absolute($linktext))?$linktext:File::Spec->catfile($RealBin,$linktext);}$Bin=abs_path($Bin)if($Bin);
$RealBin=abs_path($RealBin)if($RealBin);}}}1;
