| 2 |
## $Id$ |
## $Id$ |
| 3 |
## ---------------------------------------------------------------------- |
## ---------------------------------------------------------------------- |
| 4 |
## $Log$ |
## $Log$ |
| 5 |
|
## Revision 1.14 2004/05/12 14:23:31 jonen |
| 6 |
|
## add comment/code related to PERL5LIB var at different OS's |
| 7 |
|
## |
| 8 |
|
## Revision 1.13 2003/12/05 05:02:08 joko |
| 9 |
|
## + minor update: disabled some unnecessary loggers or changed to debug-level |
| 10 |
|
## |
| 11 |
|
## Revision 1.12 2003/06/24 20:59:51 jonen |
| 12 |
|
## added option 'detach' |
| 13 |
|
## |
| 14 |
## Revision 1.11 2003/06/23 17:54:32 joko |
## Revision 1.11 2003/06/23 17:54:32 joko |
| 15 |
## prepared execution of in-process perl-code via eval (not activated yet!) |
## prepared execution of in-process perl-code via eval (not activated yet!) |
| 16 |
## |
## |
| 68 |
use Data::Mungle::Transform::Deep qw( expand deep_copy ); |
use Data::Mungle::Transform::Deep qw( expand deep_copy ); |
| 69 |
use File::Temp qw/ tempfile tempdir /; |
use File::Temp qw/ tempfile tempdir /; |
| 70 |
|
|
| 71 |
|
my $DEBUG = 0; |
| 72 |
|
|
| 73 |
sub performTarget { |
sub performTarget { |
| 74 |
my $self = shift; |
my $self = shift; |
| 96 |
#$self->log($header, 'notice'); |
#$self->log($header, 'notice'); |
| 97 |
|
|
| 98 |
# V3 |
# V3 |
| 99 |
$self->log("- " x 20, 'info'); |
#$self->log("- " x 20, 'info'); |
| 100 |
$self->log("Performing Target '$targetname'.", 'notice'); |
$self->log("Performing Target '$targetname'.", 'notice'); |
| 101 |
|
|
| 102 |
#exit; |
#exit; |
| 145 |
my $content = $entry->{content}; |
my $content = $entry->{content}; |
| 146 |
$self->perform_command($command, $args, $content, { warn => 1 } ); |
$self->perform_command($command, $args, $content, { warn => 1 } ); |
| 147 |
# check recursiveness |
# check recursiveness |
| 148 |
# new condition: don't recurse if node is flagged to have inline-args (2004-04-17) |
# new condition: don't recurse if node is flagged to have inline-args (2003-04-17) |
| 149 |
my $has_inline_args = ($entry->{attrib}->{_args} && $entry->{attrib}->{_args} eq 'inline'); |
my $has_inline_args = ($entry->{attrib}->{_args} && $entry->{attrib}->{_args} eq 'inline'); |
| 150 |
if ($entry->{content} && ref $entry->{content} && !$has_inline_args) { |
if ($entry->{content} && ref $entry->{content} && !$has_inline_args) { |
| 151 |
$self->perform_details($entry); |
$self->perform_details($entry); |
| 152 |
} |
} |
| 153 |
# new of 2003-05-08 |
# new of 2003-05-08 |
| 154 |
|
$command ||= ''; |
| 155 |
$self->perform_command($command . '_end', undef, undef, { warn => 0 } ); |
$self->perform_command($command . '_end', undef, undef, { warn => 0 } ); |
| 156 |
} |
} |
| 157 |
} |
} |
| 169 |
my $options = shift; |
my $options = shift; |
| 170 |
|
|
| 171 |
if (!$command) { |
if (!$command) { |
| 172 |
$self->log("Command was empty!", 'debug'); |
$self->log("Command was empty!", 'debug') if $DEBUG; |
| 173 |
return; |
return; |
| 174 |
} |
} |
| 175 |
|
|
| 176 |
# FIXME: make '__PACKAGE__' go one level deeper properly! |
# FIXME: make '__PACKAGE__' go one level deeper properly! |
| 177 |
$self->log( __PACKAGE__ . "->perform_command: " . $command, 'debug'); |
$self->log( __PACKAGE__ . "->perform_command: " . $command, 'debug') if $DEBUG; |
| 178 |
|
|
| 179 |
|
|
| 180 |
# 1. make arguments from list of arguments(?) |
# 1. make arguments from list of arguments(?) |
| 217 |
} else { |
} else { |
| 218 |
my $level = "debug"; |
my $level = "debug"; |
| 219 |
$level = "warning" if $options->{warn}; |
$level = "warning" if $options->{warn}; |
| 220 |
$self->log("Command '$command' not implemented.", $level); |
$self->log("Command '$command' not implemented.", $level) if $DEBUG; |
| 221 |
} |
} |
| 222 |
|
|
| 223 |
} |
} |
| 344 |
|
|
| 345 |
$name = '__rap.properties.' . $name; |
$name = '__rap.properties.' . $name; |
| 346 |
|
|
| 347 |
$self->log("get-name: $name"); |
$self->log("get-name: $name") if $DEBUG; |
| 348 |
|
|
| 349 |
# get property slot and return value |
# get property slot and return value |
| 350 |
$result = ref_slot($self, $name, undef, '.'); |
$result = ref_slot($self, $name, undef, '.'); |
| 375 |
|
|
| 376 |
delete $opts->{caption}; |
delete $opts->{caption}; |
| 377 |
delete $opts->{async}; |
delete $opts->{async}; |
| 378 |
|
delete $opts->{detach}; |
| 379 |
|
|
| 380 |
#print Dumper($meta); |
#print Dumper($meta); |
| 381 |
|
|
| 420 |
#print "command: $cmd", "\n"; |
#print "command: $cmd", "\n"; |
| 421 |
|
|
| 422 |
# start process |
# start process |
| 423 |
# V1: via shortcut |
# 2004-05-11 - seems like only ONE args is valid at PERL5LIB, |
| 424 |
#$ENV{PERL5LIB} = join(' ', @INC); |
# so we use V2! |
| 425 |
|
# V1: join all args |
| 426 |
# FIXME!!! what about the other slots of @INC? |
#$ENV{PERL5LIB} = join(' ', @INC); |
| 427 |
|
# V2: insert only FIRST arg |
| 428 |
$ENV{PERL5LIB} = $INC[0]; |
$ENV{PERL5LIB} = $INC[0]; |
| 429 |
|
# WARNING: at (free)BSD our var is the SECOND, NOT FIRST!! |
| 430 |
|
# FIXME!! Do this in an abstract way!! |
| 431 |
|
#$ENV{PERL5LIB} = $INC[1]; |
| 432 |
|
|
| 433 |
#print Dumper(%ENV); |
#print Dumper(%ENV); |
| 434 |
|
|
| 440 |
# V1.b - enhanced: variable local method |
# V1.b - enhanced: variable local method |
| 441 |
$meta->{caption} ||= ''; |
$meta->{caption} ||= ''; |
| 442 |
$meta->{async} ||= 0; |
$meta->{async} ||= 0; |
| 443 |
|
$meta->{detach} ||= 0; |
| 444 |
# new of 2003-05-08: USE_PATH! |
# new of 2003-05-08: USE_PATH! |
| 445 |
$meta->{USE_PATH} ||= 0; |
$meta->{USE_PATH} ||= 0; |
| 446 |
my $evalstr = "run_cmd('$cmd', '$meta->{caption}', { async => $meta->{async}, USE_PATH => $meta->{USE_PATH} });"; |
my $evalstr = "run_cmd('$cmd', '$meta->{caption}', { async => $meta->{async}, detach => $meta->{detach}, USE_PATH => $meta->{USE_PATH} });"; |
| 447 |
eval($evalstr); |
eval($evalstr); |
| 448 |
#my $res = do "$cmd"; |
#my $res = do "$cmd"; |
| 449 |
#print $res, "\n" if $res; |
#print $res, "\n" if $res; |