Annotation of loncom/xml/run.pm, revision 1.6
1.2 albertel 1: package Apache::run;
1.1 sakharuk 2:
1.2 albertel 3: sub evaluate {
1.4 albertel 4: my ($expression,$safeeval,$decls) = @_;
1.6 ! albertel 5: # print "inside2 evaluate $decls with $expression<br>\n";
1.3 albertel 6: # gerd's old method interpolates unset vars
1.5 albertel 7: # $safeeval->reval('return qq('.$expression.');');
8: unless (defined $expression) { return ''; }
1.3 albertel 9: $safeeval->reval('$_=\''.$expression.'\';');
1.4 albertel 10: $safeeval->reval('{'.$decls.'$_=~s/(\$\{?[A-Za-z]\w*\}?)/(defined(eval($1))?eval($1):$1)/ge;}');
1.3 albertel 11: $safeeval->reval('return $_;');
1.2 albertel 12: }
13:
14: sub run {
15: my ($code,$safeeval) = @_;
1.3 albertel 16: # print "inside run\n";
1.2 albertel 17: $safeeval->reval($code);
18: }
19:
20: 1;
21: __END__;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>