sub expand_def {
my ($vars, $body) = @_;
my @varnames = $split->($vars);
+ return (\@varnames, expand_body($body));
+}
+
+sub expand_body {
+ my ($body) = @_;
local our @Body_Parts;
$tcl->Eval($body);
- return (\@varnames, @Body_Parts);
+ return @Body_Parts;
}
$tcl->CreateCommand(query => sub {
push our @Body_Parts, [ exists => expand_def($vars, $body) ];
return;
});
+
+$tcl->CreateCommand(foreach => sub {
+ my (undef, undef, undef, $var, $body, $each_body) = @_;
+ push our @Body_Parts, [
+ foreach => $var => map [ expand_body($_) ], $body, $each_body
+ ];
+ return;
+});
#$tcl->Eval(q{query D {directory_at D 't'; mode D '0755'; }});