The following trivial example works:
DOCUMENT();
loadMacros( "PGstandard.pl", # Standard macros for PG language ); TEXT(beginproblem());
$SageCode=<<END; print("\"hello\"") END $sageReply = AskSage($SageCode,{accepted_tos=>true,seed=>$problemSeed}); BEGIN_TEXT Sage reply: $sageReply END_TEXT ENDDOCUMENT();
But the following fails:
DOCUMENT(); loadMacros( "PGstandard.pl", # Standard macros for PG language ); TEXT(beginproblem()); $SageCode=<<END; print("\"hello world\"") END $sageReply = AskSage($SageCode,{accepted_tos=>true,seed=>$problemSeed}); BEGIN_TEXT Sage reply: $sageReply END_TEXT ENDDOCUMENT();
The space between "hello" and "world" seems to case the trouble. Can someone explain how to properly return strings from Sage to WeBWorK?