Forum archive 2000-2006

Andy Wildenberg - newbie multiple choice question

Andy Wildenberg - newbie multiple choice question

by Arnold Pizer -
Number of replies: 0
inactiveTopicnewbie multiple choice question topic started 1/24/2001; 1:43:28 PM
last post 1/25/2001; 4:13:22 PM
userAndy Wildenberg - newbie multiple choice question  blueArrow
1/24/2001; 1:43:28 PM (reads: 956, responses: 3)
Ok, I guess I was biting off a bit much before. This is what I get when I try and use the sample multiple choice question.

 

Problem8
ERROR caught by PGtranslator while processing problem file:setAndy/gage.pg
*
Can't locate object method qa via package "new_multiple_choice" at (eval 44) line 15.



*



------Input Read
1 DOCUMENT();
2
3 loadMacros('PG.pl',
4 'PGbasicmacros.pl',
5 'PGchoicemacros.pl',
6 'PGanswermacros.pl',
7 );
8
9 TEXT(beginproblem());
10
11 $showPartialCorrectAnswers = 0;
12
13 $mc = new_multiple_choice;
14
15 $mc->qa('( x^2 ) is:',
16 'quadratic'
17 );
18
19 $mc->extra(
20 'cubic',
21 'logarithmic',
22 'exponential'
23 );
24
25 $mc->makeLast(
26 'All of the above',
27 'None of the above'
28 );
29
30 BEGIN_TEXT
31 $PAR
32 { $mc->print_q() }
33 $PAR
34 { $mc->print_a() }
35 END_TEXT
36 ANS(radio_cmp($mc->correct_ans));



According to Multiple.pm, this is exactly what I should be doing, but it doesn't seem to recognize the method qa.

Ideas?

<| Post or View Comments |>


userMichael Gage - Re: newbie multiple choice question  blueArrow
1/24/2001; 10:43:40 PM (reads: 1182, responses: 0)
Hi Andy,

At the moment can't duplicate the behavior here on either of our machines.

Do you have the latest files for courseScript macros? I seem to remember vaguely that I fixed an error like this a month or so ago. The newest files can be obtained from "Download WeBWorK" (there is a link in the left margin). The updates you would need would be at most in the files PGchoicemacros.pl, and List.pm, Select.pm, Multiple.pm -- all of them in courseScripts -- if you are reluctant to upgrade the whole system.

For some reason the object thinks its type is "new_multiple_choice" rather than "Multiple".

Keep us posted about whether this fixes the problem.

Take care,

Mike

<| Post or View Comments |>


userAndy Wildenberg - Re: newbie multiple choice question  blueArrow
1/25/2001; 3:49:09 PM (reads: 1159, responses: 0)
According to Global.pm we're running 1.6_01 from 1/8/01. I diffed PGchoicemacros.pl, and List.pm, Select.pm, Multiple.pm between our version and the one I just downloaded from the server, and the only difference was that List.pm had a new "pretty_print" function, so I don't think that's what's going on.

As a matter of fact, these are the only files in that directory that have changed: List.pm, Matrix.pm, PG.pl, PG_CAPAmacros.pl, dangerousMacros.pl, displayMacros.pl

Ideas? Is upgrading still the recommended fix?

Andy

<| Post or View Comments |>


userMichael Gage - Re: newbie multiple choice question  blueArrow
1/25/2001; 4:13:22 PM (reads: 1176, responses: 0)
Hi Andy,

I found it -- by pasting your code directly into one of my problems instead of eyeballing the two sets of code. Sorry I didn't have time to do that sooner.

The statement

$mc = new_multiple_choice;

should be

$mc = new_multiple_choice();

I've corrected the example code as well. Thanks for catching this.

Apparently in the first example Perl assigns "new_multiple_choice" as the object type, while in the second it assigns "Multiple" which is what is needed.

Take care -- Mike

<| Post or View Comments |>