[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 12 Feb 2003 22:04:34 -0000


albertel		Wed Feb 12 17:04:34 2003 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - @ now works as an explict answer to string response
  
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.229 loncom/xml/lonxml.pm:1.230
--- loncom/xml/lonxml.pm:1.229	Wed Feb 12 15:43:18 2003
+++ loncom/xml/lonxml.pm	Wed Feb 12 17:04:34 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.229 2003/02/12 20:43:18 sakharuk Exp $
+# $Id: lonxml.pm,v 1.230 2003/02/12 22:04:34 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1506,14 +1506,22 @@
   if ( ! $context ) { $context = -1; }
   my $args ='';
   if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; }
+  &Apache::lonxml::debug("Args are $args param is $param");
   if ($case_insensitive) {
       if (! ($args=~s/(my \$)(\Q$param\E)(=\")/$1.lc($2).$3/ei)) {
 	  return undef;
       }
   } elsif ( $args !~ /my \$\Q$param\E=\"/ ) { return undef; }
   my $value=&Apache::run::run("{$args;".'return $'.$param.'}',$safeeval); #'
-  if ($value =~ /^[\$\@\%]/) {
-    return &Apache::run::run("return $value",$safeeval,1);
+  &Apache::lonxml::debug("first run is $value");
+  if ($value =~ /^[\$\@\%]\w+$/) {
+      &Apache::lonxml::debug("doing second");
+      my @result=&Apache::run::run("return $value",$safeeval,1);
+      if (!defined($result[0])) {
+	  return $value
+      } else {
+	  if (wantarray) { return @result; } else { return $result[0]; }
+      }
   } else {
     return $value;
   }