summaryrefslogtreecommitdiff
path: root/mpc.pl
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2005-11-21 15:26:51 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2005-11-21 15:26:51 +0000
commite5a235cad6a624d1be41543636a80fc526f906a5 (patch)
tree57fe99174a258fe3e8cfc36f1afbc880fcf2bdad /mpc.pl
parentf003a7abf1334fda4548db353ffac931916d9309 (diff)
downloadMPC-e5a235cad6a624d1be41543636a80fc526f906a5.tar.gz
ChangeLogTag: Mon Nov 21 09:26:35 2005 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'mpc.pl')
-rwxr-xr-xmpc.pl53
1 files changed, 2 insertions, 51 deletions
diff --git a/mpc.pl b/mpc.pl
index c146e544..c7f7c30a 100755
--- a/mpc.pl
+++ b/mpc.pl
@@ -15,9 +15,10 @@ eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}'
use strict;
use Cwd;
use Config;
+use FindBin;
use File::Basename;
-my($basePath) = getExecutePath($0);
+my($basePath) = $FindBin::Bin;
unshift(@INC, $basePath . '/modules');
require MPC;
@@ -30,56 +31,6 @@ sub getBasePath {
return $basePath;
}
-
-sub which {
- my($prog) = shift;
- my($exec) = $prog;
-
- if (defined $ENV{'PATH'}) {
- my($part) = '';
- my($envSep) = $Config{'path_sep'};
- foreach $part (split(/$envSep/, $ENV{'PATH'})) {
- $part .= "/$prog";
- if ( -x $part ) {
- $exec = $part;
- last;
- }
- }
- }
-
- return $exec;
-}
-
-
-sub getExecutePath {
- my($prog) = shift;
- my($loc) = '';
-
- if ($prog ne basename($prog)) {
- if ($prog =~ /^[\/\\]/ ||
- $prog =~ /^[A-Za-z]:[\/\\]?/) {
- $loc = dirname($prog);
- }
- else {
- $loc = getcwd() . '/' . dirname($prog);
- }
- }
- else {
- $loc = dirname(which($prog));
- }
-
- if ($loc eq '.') {
- $loc = getcwd();
- }
-
- if ($loc ne '') {
- $loc .= '/';
- }
-
- return $loc;
-}
-
-
# ************************************************************
# Main Section
# ************************************************************