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