[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 18 Sep 2006 21:47:34 -0000
albertel Mon Sep 18 17:47:34 2006 EDT
Modified files:
/loncom/xml lonxml.pm
Log:
- BUG#5013
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.416 loncom/xml/lonxml.pm:1.417
--- loncom/xml/lonxml.pm:1.416 Thu Sep 14 17:52:36 2006
+++ loncom/xml/lonxml.pm Mon Sep 18 17:47:34 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.416 2006/09/14 21:52:36 albertel Exp $
+# $Id: lonxml.pm,v 1.417 2006/09/18 21:47:34 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1149,19 +1149,24 @@
}
sub parstring {
- my ($token) = @_;
- my $temp='';
- foreach (@{$token->[3]}) {
- unless ($_=~/\W/) {
- my $val=$token->[2]->{$_};
- $val =~ s/([\%\@\\\"\'])/\\$1/g;
- $val =~ s/(\$[^{a-zA-Z_])/\\$1/g;
- $val =~ s/(\$)$/\\$1/;
- #if ($val =~ m/^[\%\@]/) { $val="\\".$val; }
- $temp .= "my \$$_=\"$val\";";
- }
- }
- return $temp;
+ my ($token) = @_;
+ my (@vars,@values);
+ foreach my $attr (@{$token->[3]}) {
+ if ($attr!~/\W/) {
+ my $val=$token->[2]->{$attr};
+ $val =~ s/([\%\@\\\"\'])/\\$1/g;
+ $val =~ s/(\$[^\{a-zA-Z_])/\\$1/g;
+ $val =~ s/(\$)$/\\$1/;
+ #if ($val =~ m/^[\%\@]/) { $val="\\".$val; }
+ push(@vars,"\$$attr");
+ push(@values,"\"$val\"");
+ }
+ }
+ my $var_init =
+ (@vars) ? 'my ('.join(',',@vars).') = ('.join(',',@values).');'
+ : '';
+ print STDERR $var_init."\n";
+ return $var_init;
}
sub extlink {
@@ -1624,14 +1629,14 @@
}
if ( ! $args ) { return undef; }
if ( $case_insensitive ) {
- if ($args =~ s/(my \$)(\Q$param\E)(=\")/$1.lc($2).$3/ei) {
+ if ($args =~ s/(my (?:.*))(\$\Q$param\E[,\)])/$1.lc($2)/ei) {
return &Apache::run::run("{$args;".'return $'.$param.'}',
$safeeval); #'
} else {
return undef;
}
} else {
- if ( $args =~ /my \$\Q$param\E=\"/ ) {
+ if ( $args =~ /my .*\$\Q$param\E[,\)]/ ) {
return &Apache::run::run("{$args;".'return $'.$param.'}',
$safeeval); #'
} else {