2 |
## $Id$ |
## $Id$ |
3 |
## --------------------------------------------------------------------------- |
## --------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.10 2003/06/23 15:59:16 joko |
6 |
|
## major/minor fixes? |
7 |
|
## |
8 |
## Revision 1.9 2003/05/13 05:36:24 joko |
## Revision 1.9 2003/05/13 05:36:24 joko |
9 |
## heavy modifications to run_cmd |
## heavy modifications to run_cmd |
10 |
## + sub get_executable |
## + sub get_executable |
83 |
# => better use absolute path-names only?! |
# => better use absolute path-names only?! |
84 |
my $application = ''; |
my $application = ''; |
85 |
if ($cmd =~ m/\w+\.pl\s*.*/) { |
if ($cmd =~ m/\w+\.pl\s*.*/) { |
86 |
$application = 'perl'; |
$application = 'perl '; |
87 |
|
} else { |
88 |
|
$application = './'; |
89 |
} |
} |
90 |
return $application; |
return $application; |
91 |
} |
} |
146 |
} else { |
} else { |
147 |
-e $executable or die("$executable does not exist."); |
-e $executable or die("$executable does not exist."); |
148 |
#$basedir = "."; |
#$basedir = "."; |
149 |
$basedir .= './'; |
#$basedir .= './'; |
150 |
} |
} |
151 |
$cmd = "$basedir$cmd"; |
$cmd = "$basedir$cmd"; |
152 |
|
|
157 |
# V2 - via 'system' |
# V2 - via 'system' |
158 |
#system($cmd); |
#system($cmd); |
159 |
|
|
160 |
|
if (not $use_path) { |
161 |
|
my $application = get_executable($cmd); |
162 |
|
$cmd = "$application$cmd" if $application; |
163 |
|
} |
164 |
|
|
165 |
# V3 - using IPC::Run (optional) |
# V3 - using IPC::Run (optional) |
166 |
if ($options->{async}) { |
if ($options->{async}) { |
167 |
my $application = get_executable_wrapper($cmd); |
my $application = get_executable_wrapper($cmd); |
181 |
#start $cmd or die("IPC::Run could not start '$cmd'."); |
#start $cmd or die("IPC::Run could not start '$cmd'."); |
182 |
|
|
183 |
} else { |
} else { |
|
if (!$use_path) { |
|
|
my $application = get_executable($cmd); |
|
|
$cmd = "$application $cmd" if $application; |
|
|
} |
|
184 |
print "run_cmd: system('$cmd').", "\n"; |
print "run_cmd: system('$cmd').", "\n"; |
185 |
system($cmd); |
system($cmd); |
186 |
} |
} |