use IO::File;
our @cond;
-our $temp;
sub get_nested($$$) {
my ($r,$left,$right) = @_;
sub eval_if_ok($) {
if ($cond[0] > 0) {
my $x = shift;
- my $res = eval $x;
+ my $res = eval "package T; $x";
return $res unless $@;
die "Error evaluating $x: $@";
} else {
finish();
}
-### Commands available from the templates
+### Perl commands embedded in the templates are evaluated in this package ###
+
+package T;
+
+our $temp;
sub include {
my $fn = shift @_;
while (@_) {
my $v = shift @_;
$temp = shift @_;
- eval_if_ok("\$$v = \$temp");
+ UCW::Temple::eval_if_ok("\$$v = \$temp");
}
- parse_file($fn);
+ UCW::Temple::parse_file($fn);
}
sub load {