--- loncom/homework/templates/sampleexternal.pl 2011/04/29 00:32:11 1.2 +++ loncom/homework/templates/sampleexternal.pl 2012/02/04 15:12:40 1.3 @@ -46,7 +46,11 @@ my $message=''; foreach my $testcase (split(/\,/,$FORM{'LONCAPA_correct_answer'})) { my ($value,$result)=split(/\=/,$testcase); # Execute the student code and call the expected function - my $studentanswer=$compartment->reval($FORM{'LONCAPA_student_response'}.'&factorial('.$value.')'); + my $studentanswer=$compartment->reval( +$FORM{'somecode'}."\n". +$FORM{'LONCAPA_student_response'}."\n". +'&factorial('.$value.')' +); # A syntax error occurred if ($@) { $award='WRONG_FORMAT'; @@ -86,12 +90,15 @@ foreach my $testcase (split(/\,/,$FORM{' # # For partial correctness, awarddetail needs to be ASSIGNED_SCORE # The partial score would be in +# The message is passed as unparsed character data, so embedded HTML +# or entities do not get parsed by LON-CAPA's internal parser. Remove +# the CDATA wrapper if you want the parser to process the message. # print (< $award - $message + ENDOUT