From: Mike G. v. a. <we...@ma...> - 2005-07-01 12:17:40
|
Log Message: ----------- Fixed a bug in which the constant 'function' BASE64_ENCODED was not being evaluated inside the matching and substitution statements. Replaced the constant by using the construction our $BASE64_ENCODED = 'base64_encoded:'; instead. The variable is properly interpolated inside the matching and substitution statements. Modified Files: -------------- webwork-modperl/lib/WeBWorK: Utils.pm Revision Data ------------- Index: Utils.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/Utils.pm,v retrieving revision 1.64 retrieving revision 1.65 diff -Llib/WeBWorK/Utils.pm -Llib/WeBWorK/Utils.pm -u -r1.64 -r1.65 --- lib/WeBWorK/Utils.pm +++ lib/WeBWorK/Utils.pm @@ -651,12 +651,16 @@ $result .= defined $ref ? $ref : '<font color="red">undef</font>'; } } -use constant BASE64_ENCODED => 'base64_encoded:'; +our $BASE64_ENCODED = 'base64_encoded:'; +# use constant BASE64_ENCODED = 'base64_encoded; +# was not evaluated in the matching and substitution +# statements sub decodeAnswers($) { my $string = shift; return unless defined $string and $string; - if ($string =~/^BASE64_ENCODED/) { - $string =~ s/^BASE64_ENCODED//; + + if ($string =~/^$BASE64_ENCODED/o) { + $string =~ s/^$BASE64_ENCODED//o; $string = decode_base64($string); } @@ -687,7 +691,7 @@ } $string =~ s/##$//; # remove last pair of hashs - $string = BASE64_ENCODED.encode_base64($string); + $string = $BASE64_ENCODED.encode_base64($string); return $string; } |