WeBWorK Problems

compoundProblem.pl errors

compoundProblem.pl errors

by Balagopal Pillai -
Number of replies: 5
Hi,

           One of the webwork problems is throwing the following error -
 
           ERRORS from evaluating PG file: 
Error detected while loading [PG]/macros/compoundProblem.pl: PG_macro_file_eval detected error at line 123 of file [PG]/lib/PGloadfiles.pm Can't use 'defined(%hash)' (Maybe you should just omit the defined()?) at line 585 of [PG]/macros/compoundProblem.pl, chunk 1. The calling package is PGloadfiles Died within PGloadfiles::compile_file called at line 171 of [PG]/lib/PGloadfiles.pm from within PGloadfiles::loadMacros called at line 514 of [PG]/macros/PG.pl from within main::loadMacros called at line 14 of (eval 1626) 

         The OS is ubuntu 16.04 and perl version is 5.22 and the pg file uses compoundProblem.pl. This used to work last term with debian 8 and perl 5.20. 
         I noticed the following -
 
         from debian 8 - 
 
 
defined(%hash) is deprecated at compoundProblem.pl line 583.
(Maybe you should just omit the defined()?)
from ubuntu 16.04 - 
Can't use 'defined(%hash)' (Maybe you should just omit the defined()?) at compoundProblem.pl line 583.
      Looks like a warning on the old perl version turned out to be an error on the new version. I was wondering if there is a work around for this or may be an updated version of compoundProblem.pl available. Thanks a lot.


Balagopal
In reply to Balagopal Pillai

Re: compoundProblem.pl errors

by Balagopal Pillai -
Here is one more file that has a similar issue as above -

Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at answerDiscussion.pl line 121.

Thanks
In reply to Balagopal Pillai

Re: compoundProblem.pl errors

by Balagopal Pillai -
Hi,

      As an update to the issue, I changed the line 
if (defined(%main::images_created)) to if ((%main::images_created)) as recommended by some perl forums and seems like it is working now. 
Was that the right fix? Thanks. 
In reply to Balagopal Pillai

Re: compoundProblem.pl errors

by Michael Gage -
That's probably the right fix, but just to make sure this gets settled for future users as well could you submit this message to bugzilla (http://bugs.webwork.maa.org/).  Please include the path to the specific problem(s) that caused this.  If the problems are not in the library just copy the text of the problem into the bug report.   We can update compoundProblem.pl and answerDiscussion.pl.  CompoundProblem is a bit obsolete itself -- you might look into using scaffold.pl  instead -- but the original problem itself would need to be reworked to use scaffold.pl.

Thanks.
-- Mike