| 2 |
## $Id$ |
## $Id$ |
| 3 |
## ---------------------------------------------------------------------- |
## ---------------------------------------------------------------------- |
| 4 |
## $Log$ |
## $Log$ |
| 5 |
|
## Revision 1.10 2003/05/13 07:56:12 joko |
| 6 |
|
## enhanced: *hierarchical* containers for context handling |
| 7 |
|
## fixes: some pre-flight checks |
| 8 |
|
## new: propagate "end-tag" event to e.g. close containers |
| 9 |
|
## |
| 10 |
## Revision 1.9 2003/04/04 17:23:11 joko |
## Revision 1.9 2003/04/04 17:23:11 joko |
| 11 |
## minor update: debugging output |
## minor update: debugging output |
| 12 |
## |
## |
| 67 |
my $self = shift; |
my $self = shift; |
| 68 |
my $targetname = shift; |
my $targetname = shift; |
| 69 |
|
|
| 70 |
|
# pre-flight checks |
| 71 |
|
if (!$targetname) { |
| 72 |
|
$self->log("Target name empty. Please try to specify (e.g.) on the command line.", 'critical'); |
| 73 |
|
return; |
| 74 |
|
} |
| 75 |
|
|
| 76 |
my $header = ("- " x 12) . " " . $targetname . " " . ("- " x 6); |
my $header = ("- " x 12) . " " . $targetname . " " . ("- " x 6); |
| 77 |
|
|
| 78 |
# V1 |
# V1 |
| 96 |
|
|
| 97 |
$self->perform_dependencies($target); |
$self->perform_dependencies($target); |
| 98 |
$self->perform_details($target); |
$self->perform_details($target); |
| 99 |
|
|
| 100 |
|
return 1; |
| 101 |
|
|
| 102 |
} |
} |
| 103 |
|
|
| 130 |
my $command = $entry->{name}; |
my $command = $entry->{name}; |
| 131 |
my $args = $entry->{attrib}; |
my $args = $entry->{attrib}; |
| 132 |
my $content = $entry->{content}; |
my $content = $entry->{content}; |
| 133 |
$self->perform_command($command, $args, $content); |
$self->perform_command($command, $args, $content, { warn => 1 } ); |
| 134 |
# check recursiveness |
# check recursiveness |
| 135 |
if ($entry->{content} && ref $entry->{content}) { |
# new condition: don't recurse if node is flagged to have inline-args (2004-04-17) |
| 136 |
|
my $has_inline_args = ($entry->{attrib}->{_args} && $entry->{attrib}->{_args} eq 'inline'); |
| 137 |
|
if ($entry->{content} && ref $entry->{content} && !$has_inline_args) { |
| 138 |
$self->perform_details($entry); |
$self->perform_details($entry); |
| 139 |
} |
} |
| 140 |
|
# new of 2003-05-08 |
| 141 |
|
$self->perform_command($command . '_end', undef, undef, { warn => 0 } ); |
| 142 |
} |
} |
| 143 |
} |
} |
| 144 |
|
|
| 152 |
my $command = shift; |
my $command = shift; |
| 153 |
my $args_list = shift; |
my $args_list = shift; |
| 154 |
my $content = shift; |
my $content = shift; |
| 155 |
|
my $options = shift; |
| 156 |
|
|
| 157 |
if (!$command) { |
if (!$command) { |
| 158 |
$self->log("Command was empty!", 'debug'); |
$self->log("Command was empty!", 'debug'); |
| 162 |
# FIXME: make '__PACKAGE__' go one level deeper properly! |
# FIXME: make '__PACKAGE__' go one level deeper properly! |
| 163 |
$self->log( __PACKAGE__ . "->perform_command: " . $command, 'debug'); |
$self->log( __PACKAGE__ . "->perform_command: " . $command, 'debug'); |
| 164 |
|
|
| 165 |
|
|
| 166 |
|
# 1. make arguments from list of arguments(?) |
| 167 |
|
|
| 168 |
my $args = {}; |
my $args = {}; |
| 169 |
#print Dumper($args_list); |
#print Dumper($args_list); |
| 170 |
if ($args_list) { |
if ($args_list) { |
| 176 |
$args = $args_list; |
$args = $args_list; |
| 177 |
} |
} |
| 178 |
} |
} |
|
$command = '_' . $command; |
|
| 179 |
|
|
| 180 |
|
|
| 181 |
# determine container |
# 2. prepare command |
| 182 |
|
|
| 183 |
|
# default setting for internal rap commands |
| 184 |
|
my $method_prefix_default = '_'; |
| 185 |
|
# setting from property database |
| 186 |
|
my $method_prefix_setting = $self->get_property('core.method_prefix'); |
| 187 |
|
#print "setting: ", $method_prefix_setting, "\n"; |
| 188 |
|
my $prefix = $method_prefix_setting; |
| 189 |
|
if (not defined $prefix) { |
| 190 |
|
$prefix = $method_prefix_default; |
| 191 |
|
} |
| 192 |
|
$command = $prefix . $command; |
| 193 |
|
|
| 194 |
|
|
| 195 |
|
# 3. determine container |
| 196 |
my $container; # = $self->getInstance(); |
my $container; # = $self->getInstance(); |
| 197 |
|
#$container ||= $self->getInstance(); |
| 198 |
$container ||= $self; |
$container ||= $self; |
| 199 |
|
|
| 200 |
|
# 4. run method |
| 201 |
if ($container->can($command)) { |
if ($container->can($command)) { |
| 202 |
$container->$command($args, $content); |
$container->$command($args, $content); |
| 203 |
} else { |
} else { |
| 204 |
$self->log("Command '$command' not implemented.", "warning"); |
my $level = "debug"; |
| 205 |
|
$level = "warning" if $options->{warn}; |
| 206 |
|
$self->log("Command '$command' not implemented.", $level); |
| 207 |
} |
} |
| 208 |
|
|
| 209 |
} |
} |
| 267 |
|
|
| 268 |
$self->log("set-name: $name"); |
$self->log("set-name: $name"); |
| 269 |
|
|
| 270 |
|
#print Dumper($name, $value, '.'); |
| 271 |
|
|
| 272 |
# fill property slot with given value |
# fill property slot with given value |
| 273 |
if ($value) { |
# fix (2003-04-17): always do fill if value is *defined*!!! |
| 274 |
|
if (defined $value) { |
| 275 |
ref_slot($self, $name, $value, '.'); |
ref_slot($self, $name, $value, '.'); |
| 276 |
} |
} |
| 277 |
|
|
| 421 |
# V1.b - enhanced: variable local method |
# V1.b - enhanced: variable local method |
| 422 |
$meta->{caption} ||= ''; |
$meta->{caption} ||= ''; |
| 423 |
$meta->{async} ||= 0; |
$meta->{async} ||= 0; |
| 424 |
my $evalstr = "run_cmd('$cmd', '$meta->{caption}', { async => $meta->{async} });"; |
# new of 2003-05-08: USE_PATH! |
| 425 |
|
$meta->{USE_PATH} ||= 0; |
| 426 |
|
my $evalstr = "run_cmd('$cmd', '$meta->{caption}', { async => $meta->{async}, USE_PATH => $meta->{USE_PATH} });"; |
| 427 |
eval($evalstr); |
eval($evalstr); |
| 428 |
#my $res = do "$cmd"; |
#my $res = do "$cmd"; |
| 429 |
#print $res, "\n" if $res; |
#print $res, "\n" if $res; |