2 |
## $Id$ |
## $Id$ |
3 |
## ---------------------------------------------------------------------- |
## ---------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.7 2003/03/28 07:02:56 joko |
6 |
|
## modified structure around '$wrapper_program' |
7 |
|
## |
8 |
|
## Revision 1.6 2003/03/27 15:31:05 joko |
9 |
|
## fixes to modules regarding new namespace(s) below Data::Mungle::* |
10 |
|
## |
11 |
## Revision 1.5 2003/03/27 15:03:03 joko |
## Revision 1.5 2003/03/27 15:03:03 joko |
12 |
## enhanced 'sub run_executable' |
## enhanced 'sub run_executable' |
13 |
## |
## |
40 |
use Iterate; |
use Iterate; |
41 |
|
|
42 |
use shortcuts qw( run_cmd ); |
use shortcuts qw( run_cmd ); |
43 |
use Data::Code::Ref qw( ref_slot ); |
use Data::Mungle::Code::Ref qw( ref_slot ); |
44 |
use Data::Transform::Deep qw( expand ); |
use Data::Mungle::Transform::Deep qw( expand ); |
45 |
|
|
46 |
|
|
47 |
sub performTarget { |
sub performTarget { |
306 |
delete $opts->{executable}; |
delete $opts->{executable}; |
307 |
|
|
308 |
# determine execution method |
# determine execution method |
|
my $method = 'run_cmd'; |
|
309 |
my $wrapper_program = ''; |
my $wrapper_program = ''; |
310 |
|
|
311 |
# check if program is a namespace-string (contains '::') - use 'do' in this case! |
# check if program is a namespace-string (contains '::') - use 'do' in this case! |
312 |
if ($program =~ /::/) { |
if ($program =~ /::/) { |
313 |
#if ($program =~ s/::/\\/g) { |
#$wrapper_program = 'rap.pl'; |
314 |
#$program = '.\\' . $program; |
$wrapper_program = $0; |
|
#$method = 'require'; |
|
|
#do "$program"; |
|
|
#return; |
|
|
#$method = 'rap.'; |
|
|
|
|
|
$wrapper_program = 'rap.pl'; |
|
|
|
|
315 |
} |
} |
316 |
|
|
317 |
# prepare arguments |
# prepare arguments |
335 |
} |
} |
336 |
|
|
337 |
# build {program} & {arguments} |
# build {program} & {arguments} |
338 |
my $cmd = join(' ', $wrapper_program, $program) . ' ' . join(' ', @buf); |
my $cmd = ($wrapper_program ? $wrapper_program . ' ' : '') . $program . ' ' . join(' ', @buf); |
339 |
|
|
340 |
# trace |
# trace |
341 |
#print "command: $cmd", "\n"; |
#print "command: $cmd", "\n"; |
349 |
|
|
350 |
#print Dumper(%ENV); |
#print Dumper(%ENV); |
351 |
|
|
352 |
print "command: '$cmd'", "\n"; |
#print "command: '$cmd'", "\n"; |
353 |
|
|
354 |
# V1 - basic |
# V1 - basic |
355 |
#run_cmd($cmd); |
#run_cmd($cmd); |
356 |
|
|
357 |
# V1.b - enhanced: variable local method |
# V1.b - enhanced: variable local method |
358 |
my $evalstr = "$method('$cmd');"; |
my $evalstr = "run_cmd('$cmd', 'Some task...', { async => 1 });"; |
359 |
eval($evalstr); |
eval($evalstr); |
360 |
#my $res = do "$cmd"; |
#my $res = do "$cmd"; |
361 |
#print $res, "\n" if $res; |
#print $res, "\n" if $res; |
365 |
|
|
366 |
# V2: via IPC::Run |
# V2: via IPC::Run |
367 |
# .... (TODO) |
# .... (TODO) |
368 |
|
|
369 |
|
|
370 |
} |
} |
371 |
|
|