WeBWorK Problems

Help on answerDiscussion.pl

Help on answerDiscussion.pl

by Raghu Gompa -
Number of replies: 6
Dear Friends,

I have been able to use answerDiscussion.pl, developed by Davide, to achieve several things in terms of student discussions with mathematical text until this semester. I do not know what happened; I am getting the following error message:

Error messages

Undefined subroutine &main::surePathToTmpFile called at line 848 of (eval 3500) Died within Discussion::Read called at line 214 of (eval 3500) from within Discussion::getNewEntries called at line 349 of (eval 3500) from within Discussion::Begin called at line 41 of (eval 3343)

Error details

 Problem3
ERROR caught by Translator while processing problem file:S09participate/answerDiscussionCourse.pg
****************
Undefined subroutine &main::surePathToTmpFile called at line 848 of (eval 3500)
 Died within Discussion::Read called at line 214 of (eval 3500)
 from within Discussion::getNewEntries called at line 349 of (eval 3500)

 from within Discussion::Begin called at line 41 of (eval 3343)




Please help. .. Raghu
In reply to Raghu Gompa

Re: Help on answerDiscussion.pl

by Davide Cervone -
The surePathToTmpFile() function is in IO.pl, and that is supposed to be loaded automatically, but it looks like it isn't. Unfortunately, it is not one that you can load yourself, as it can't be defined in "safe" mode. I suspect that something Mike did over the summer when he restructured the PG internals probably is the culprit, here. Mike, did you change how IO.pl is laoded? (I still haven't looked at the changes.)

Davide
In reply to Raghu Gompa

Re: Help on answerDiscussion.pl

by Michael Gage -
Hi Raghu,

I don't have a copy of the current answerDiscussion.pl so I can't test this directly.

You should be able to get this work again by using

$main::PG->surePathToTmpFile(.....)

instead of surePathToTmpFile(.....)

in the file.


An alternative (not quite as good but it should work) is to
add IO.pl to your loadMacros(); command.

-------


If you send me a copy of the .pl file I'll put it somewhere in the standard distribution so that if there are further changes in the basic macros of PG the answerDiscussion.pl file will be updated at the same time.

Take care,

Mike

In reply to Michael Gage

Re: Help on answerDiscussion.pl

by Davide Cervone -
Unfortunately, you can't load IO.pl via loadMacros() since it uses restricted commands (things not allowed in Safe.pm). So you will have to go with the $main::PG->surePathToTmpFile approach.

Davide
In reply to Davide Cervone

Re: Help on answerDiscussion.pl

by Raghu Gompa -
Dear Mike, thank you very much. Your suggestion of replacing a string removed the error message, however, the program did not work. It supposed to record messages and retrieve them. It seems to record messages, however, it is not retrieving. It also should have formatted the messages in a specific manner; it is not working the way it used to. I suspect that several strings (such as,

main::PG_restricted_eval

main::findMacroFile

main::read_whole_file

main::PGsort

etc.)

need to be modified.


I tried including IO.pl, however, it created more errors (just as Davide predicted).

I am not sure how to handle this.


Please help.
Thanks. .. Raghu
In reply to Raghu Gompa

Re: Help on answerDiscussion.pl

by Raghu Gompa -

answerDiscussion.pl is not working any more because of changes in WeBWorK last summer. As I understand it, the IO modules were moved into the PGcore object. It would take some time to make changes in the program to this effect. Mike suggested changes similar to

$main::PG->surePathToTmpFile(.
....)

instead of main::surePathToTmpFile(.....)


Here is the link for a thread which describes some background on answerDiscussion.pl:

http://webwork.maa.org/moodle/mod/forum/discuss.php?d=1949#p4391


.. Raghu
In reply to Raghu Gompa

Re: Help on answerDiscussion.pl

by Raghu Gompa -
Dear Mike,

This line

my $studentFile = main::findMacroFile(self->{
studentFile});

is not finding the file. The change you suggested $main::PG-> giving error too. Can you suggest a change to this line? Thanks. .. Raghu

PS: I was able to make several changes (very crude) so that the program is working. You can view the problem set MyJournal to view it. I am still working on problem set MyParticipation (this is where mathematical discussions from all students take place).

Here is the link:

https://courses.webwork.maa.org/webwork2/jsu-112/MyJournal/2/