Resolve $0 if symlinked
authorshort <>
Sun, 19 Oct 2003 06:08:01 +0000 (06:08 +0000)
committershort <>
Sun, 19 Oct 2003 06:08:01 +0000 (06:08 +0000)
perlmail-sendmail

index 276e3dd..9f7c30c 100755 (executable)
@@ -25,10 +25,12 @@ use warnings;
 
 use File::Basename;
 BEGIN {
-       use lib $ENV{"PERLMAIL_BASEDIR"} || File::Basename::dirname($0);
-       use PerlMail::Config;
-       use PerlMail::Lib;
+       my $self=$0;
+       $self=readlink $self while -l $self;
+       eval 'use lib $ENV{"PERLMAIL_BASEDIR"} || File::Basename::dirname($self);';
        }
+use PerlMail::Config;
+use PerlMail::Lib;
 
 require Getopt::Long;
 use POSIX qw(WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG);